Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.
/ percolate Public archive
generated from Tamschi/rust-template

[WIP] Yet another futures utility library.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

Tamschi/percolate

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.

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.

About

[WIP] Yet another futures utility library.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Languages