pub struct Outputs<T, const N: usize = 0> { /* private fields */ }Implementations§
Source§impl<T, const N: usize> Outputs<T, N>
impl<T, const N: usize> Outputs<T, N>
pub fn close(&mut self)
pub fn direction(&self) -> PortDirection
pub fn state(&self) -> PortState
pub fn capacity(&self) -> Option<usize>
pub fn max_capacity(&self) -> Option<usize>
Sourcepub async fn send(&self, message: T) -> Result<(), SendError>
pub async fn send(&self, message: T) -> Result<(), SendError>
Examples found in repository?
More examples
examples/basic.rs (line 9)
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 send_event(&self, event: PortEvent<T>) -> Result<(), SendError>
pub fn blocking_send(&self, _message: T) -> Result<(), SendError>
Trait Implementations§
Source§impl<T, const N: usize> MaybeLabeled for Outputs<T, N>
impl<T, const N: usize> MaybeLabeled for Outputs<T, N>
Source§impl<T, const N: usize> MaybeNamed for Outputs<T, N>
impl<T, const N: usize> MaybeNamed for Outputs<T, N>
Source§impl<T: Send, const N: usize> Port<T> for Outputs<T, N>
impl<T: Send, const N: usize> Port<T> for Outputs<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 Outputs<T, N>
impl<T, const N: usize> RefUnwindSafe for Outputs<T, N>
impl<T, const N: usize> Send for Outputs<T, N>where
T: Send,
impl<T, const N: usize> Sync for Outputs<T, N>where
T: Send,
impl<T, const N: usize> Unpin for Outputs<T, N>
impl<T, const N: usize> UnwindSafe for Outputs<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