https://github.com/znx3p0/named_fut
https://github.com/znx3p0/named_fut
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/znx3p0/named_fut
- Owner: znx3p0
- Created: 2021-08-13T01:13:03.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-13T01:13:05.000Z (almost 4 years ago)
- Last Synced: 2025-01-09T07:13:05.431Z (4 months ago)
- Language: Rust
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# named fut
Creates a named future which can be used for async traits.
An example of this crate in use is [`qcomms`](https://github.com/znx3p0/qcomms), as it was the inspiration for this library```rust
use async_std::io::prelude::Write;#[named_fut(SendFut)]
pub async fn send_testing<'a, T>(st: &'a mut T) -> () where T: Write + Unpin {
st.write(b"testing").await;
}trait SendTesting {
type Stream: Write + Unpin;
fn get_stream(&mut self) -> Self::Stream;
fn send_testing<'a>(&'a mut self) -> SendFut<'a, Self::Stream> {
SendFut { st: self }
}
}```