{"id":13682727,"url":"https://github.com/Boereck/fn_block","last_synced_at":"2025-04-30T09:34:01.078Z","repository":{"id":57631243,"uuid":"135188733","full_name":"Boereck/fn_block","owner":"Boereck","description":"Library for wrapping a Rust block or expression into a closure and call it.","archived":false,"fork":false,"pushed_at":"2018-07-31T08:09:00.000Z","size":27,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-08T08:44:34.438Z","etag":null,"topics":["closures","macros","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Boereck.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-28T17:08:13.000Z","updated_at":"2018-07-31T08:09:02.000Z","dependencies_parsed_at":"2022-09-26T20:20:23.927Z","dependency_job_id":null,"html_url":"https://github.com/Boereck/fn_block","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Boereck%2Ffn_block","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Boereck%2Ffn_block/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Boereck%2Ffn_block/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Boereck%2Ffn_block/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Boereck","download_url":"https://codeload.github.com/Boereck/fn_block/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224206199,"owners_count":17273405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["closures","macros","rust"],"created_at":"2024-08-02T13:01:51.933Z","updated_at":"2024-11-12T02:31:37.995Z","avatar_url":"https://github.com/Boereck.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/Boereck/fn_block.svg?branch=master)](https://travis-ci.org/Boereck/fn_block) \n[![AppVeyor Status](https://ci.appveyor.com/api/projects/status/apctgp7w8qcwttag?svg=true)](https://ci.appveyor.com/project/Boereck/fn-block) \n[![Crates.io Version](https://img.shields.io/crates/v/fn_block.svg)](https://crates.io/crates/fn_block)\n\n# `fn_block` Crate\n\nLibrary defining macros for calling blocks or expressions in a closure.\n\n## Quick Introduction\n\nThis library was mostly written to allow \"safe navigation\" with the `?.` operator combination\n(seemingly) without jumping out of the current function. This allows a similar use of the operator\nas in other languages (such as Swift, C# or Kotlin).\n\nTo use this library, you have to add it to the dependencies of your `Cargo.toml` file\n\n```toml\n[dependencies]\nfn_block = \"0.2.1\"\n```\n\nThen add the following lines to your module:\n\n```rust\n#[macro_use]\nextern crate fn_block;\nuse fn_block::*;\n```\nInstead of the wildcard, you can also just import the symbols you need. \n\nHere is an example on how to use the crate:\n\n```rust\nlet o = Some(\"Foobar\");\nlet s = fn_expr!{ o?.get(0..3)?.to_lowercase().into_some() };\nassert_eq!(\"foo\", s.unwrap());\n```\n\nPlease visit the [API Documentation](https://docs.rs/fn_block/latest/) for more details.\n\n## Functionality Overview\n\nIn short, this crate provides the following APIs:\n\n* The [`fn_expr`] macro allows wrapping an expression into a lambda that is directly called.\n* The [`IntoSome`] trait, which is implemented for all `Sized` types, allows to call [`into_some`] \n  on a value to move it into an `Option::Some`.\n* The [`IntoOk`] trait, which is implemented for all `Sized` types, allows to call [`into_ok`] \n  on a value to move it into an `Result::Ok`.\n\nFor more examples, please have a look at the test module.\n\n## Unstable Features\n\nTo use unstable features, the dependency declaration in your `Cargo.toml` has to be updated:\n\n```toml\n[dependencies]\nfn_block = { version = \"0.2.1\", features = [\"unproven\"] }\n```\nNote that this crate's unstable features *do* work on stable Rust.\n\nThe following unstable APIs are available:\n\n* The [`fn_try`] macro allows wrapping an expression into a lambda, being called directly and recover from errors directly afterwards.\n\n## License\n\nThe fn_block crate is licensed under the following licenses:\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT)\n\nChoose under which you want to use the library.\n\n[`fn_expr`]: https://docs.rs/fn_block/latest/fn_block/macro.fn_expr.html\n[`fn_block`]: https://docs.rs/fn_block/latest/fn_block/macro.fn_block.html\n[`fn_try`]: https://docs.rs/fn_block/latest/fn_block/macro.fn_try.html\n[`IntoSome`]: https://docs.rs/fn_block/latest/fn_block/trait.IntoSome.html\n[`into_some`]: https://docs.rs/fn_block/latest/fn_block/trait.IntoSome.html#tymethod.into_some\n[`IntoOk`]: https://docs.rs/fn_block/latest/fn_block/trait.IntoOk.html\n[`into_ok`]: https://docs.rs/fn_block/latest/fn_block/trait.IntoOk.html#tymethod.into_ok","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBoereck%2Ffn_block","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBoereck%2Ffn_block","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBoereck%2Ffn_block/lists"}