percolate

Crates.iopercolate
lib.rspercolate
version0.0.3
sourcesrc
created_at2021-05-28 22:38:38.635151
updated_at2021-06-02 23:22:22.239478
descriptionYet another async utility library.
homepagehttps://github.com/Tamschi/percolate/tree/v0.0.3
repositoryhttps://github.com/Tamschi/percolate
max_upload_size
id403326
size83,193
Tamme Schichler (Tamschi)

documentation

https://docs.rs/percolate/0.0.3

README

percolate

Lib.rs Crates.io Docs.rs

Rust 1.51 CI Crates.io - License

GitHub open issues open pull requests crev reviews

Yet another async utility library.

Note: The API will likely contain incomplete permutations during these first 0.0.x versions.

I mainly work on this crate as I need it for other projects of mine, but feel free to file an issue if you'd like to see a particular feature.

Installation

Please use cargo-edit to always add the latest version of this library:

cargo add percolate

Example

use ergo_pin::ergo_pin;
use percolate::projection::{AsyncMut, IntoProjectionMut, ProjectionMut};
use pollster::block_on;
use tap::Conv;

#[ergo_pin]
async fn project<A, B, X>(value: A, projection: impl IntoProjectionMut<A, B, X>) -> B {
    pin!(
        projection.into_projection_mut() // impl ProjectionMut<A, B>
    )                                    // Pin<&mut impl ProjectionMut<A, B>>
        .project(value)                  // PinHandleMut<dyn Future<B>>
        .await                           // B
}

assert_eq!(block_on(project(1, |x: u8| x + 1)), 2);
assert_eq!(
    block_on(project(
        1,
        // Type inference doesn't understand this on its own (yet), unfortunately.
        // We can instead pass the projection pre-converted.
        (|x| async move { x + 1 }).conv::<AsyncMut<_, _, _, _>>()),
    ),
    2,
);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Code of Conduct

Changelog

Versioning

percolate strictly follows Semantic Versioning 2.0.0 with the following exceptions:

  • The minor version will not reset to 0 on major version changes (except for v1).
    Consider it the global feature level.
  • The patch version will not reset to 0 on major or minor version changes (except for v0.1 and v1).
    Consider it the global patch level.

This includes the Rust version requirement specified above.
Earlier Rust versions may be compatible, but this can change with minor or patch releases.

Which versions are affected by features and patches can be determined from the respective headings in CHANGELOG.md.

Commit count: 70

cargo fmt