pub trait PutIf<T: 'static>: 'static {
// Required methods
fn put(&self, item: T) -> Pin<Box<dyn Future<Output = ()> + '_>>;
fn try_put(&self, item: T) -> Result<(), T>;
fn can_put(&self) -> bool;
}Expand description
What a put export offers. Implemented by the FIFO’s put side; a
PutPort holds one of these once connected.
put returns a boxed future rather than being an async fn because it is
called through dyn: a trait object cannot have an async fn whose future
type varies by implementor.
Required Methods§
Sourcefn put(&self, item: T) -> Pin<Box<dyn Future<Output = ()> + '_>>
fn put(&self, item: T) -> Pin<Box<dyn Future<Output = ()> + '_>>
Block until the FIFO has room, then hand the item over.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".