pub struct Inputs<T, const N: usize = 0> { /* private fields */ }Implementations§
Source§impl<T, const N: usize> Inputs<T, N>
impl<T, const N: usize> Inputs<T, N>
pub fn close(&mut self)
pub fn disconnect(&mut self)
pub fn direction(&self) -> PortDirection
pub fn state(&self) -> PortState
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> Option<usize>
pub fn max_capacity(&self) -> Option<usize>
Sourcepub async fn recv(&mut self) -> Result<Option<T>, RecvError>
pub async fn recv(&mut self) -> Result<Option<T>, RecvError>
Examples found in repository?
More examples
examples/basic.rs (line 13)
5pub async fn main() {
6 let (outputs, mut inputs) = async_flow::Channel::bounded(1).into_inner();
7
8 tokio::spawn(async move {
9 outputs.send("value1").await.unwrap();
10 outputs.send("value2").await.unwrap();
11 });
12
13 while let Some(message) = inputs.recv().await.unwrap() {
14 eprintln!("recv: {}", message);
15 }
16}pub async fn recv_event(&mut self) -> Result<Option<PortEvent<T>>, RecvError>
pub fn blocking_recv(&mut self) -> Result<Option<T>, RecvError>
Trait Implementations§
Source§impl<T: Send + 'static, const N: usize> InputPort<T> for Inputs<T, N>
impl<T: Send + 'static, const N: usize> InputPort<T> for Inputs<T, N>
fn recv<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, RecvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recv_all<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, RecvError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Source§impl<T, const N: usize> MaybeLabeled for Inputs<T, N>
impl<T, const N: usize> MaybeLabeled for Inputs<T, N>
Source§impl<T, const N: usize> MaybeNamed for Inputs<T, N>
impl<T, const N: usize> MaybeNamed for Inputs<T, N>
Source§impl<T: Send, const N: usize> Port<T> for Inputs<T, N>
impl<T: Send, const N: usize> Port<T> for Inputs<T, N>
Source§fn direction(&self) -> PortDirection
fn direction(&self) -> PortDirection
The dataflow direction of this port.
Source§fn is_unconnected(&self) -> bool
fn is_unconnected(&self) -> bool
Checks whether this port is currently unconnected.
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Checks whether this port is currently connected.
Source§fn is_disconnected(&self) -> bool
fn is_disconnected(&self) -> bool
Checks whether this port is currently disconnected.
Source§fn max_capacity(&self) -> Option<usize>
fn max_capacity(&self) -> Option<usize>
Returns the maximum buffer capacity of the connection.
Auto Trait Implementations§
impl<T, const N: usize> Freeze for Inputs<T, N>
impl<T, const N: usize> RefUnwindSafe for Inputs<T, N>
impl<T, const N: usize> Send for Inputs<T, N>where
T: Send,
impl<T, const N: usize> Sync for Inputs<T, N>where
T: Send,
impl<T, const N: usize> Unpin for Inputs<T, N>
impl<T, const N: usize> UnwindSafe for Inputs<T, N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more