Outputs

Struct Outputs 

Source
pub struct Outputs<T> { /* private fields */ }

Implementations§

Source§

impl<T> Outputs<T>

Source

pub fn capacity(&self) -> Option<usize>

Source

pub fn max_capacity(&self) -> Option<usize>

Source

pub async fn send(&self, value: T) -> Result<(), SendError>

Examples found in repository?
examples/sqrt.rs (line 20)
17async fn sqrt(mut inputs: Inputs<f64>, outputs: Outputs<f64>) -> Result {
18    while let Some(input) = inputs.recv().await? {
19        let output = input.sqrt();
20        outputs.send(output).await?;
21    }
22    Ok(())
23}
More examples
Hide additional examples
examples/basic.rs (line 9)
5pub async fn main() {
6    let (outputs, mut inputs) = async_flow::bounded(1);
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}
Source

pub fn send_blocking(&self, value: T) -> Result<(), SendError>

Trait Implementations§

Source§

impl<T> AsMut<Sender<T>> for Outputs<T>

Source§

fn as_mut(&mut self) -> &mut Sender<T>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T> AsRef<Sender<T>> for Outputs<T>

Source§

fn as_ref(&self) -> &Sender<T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Clone> Clone for Outputs<T>

Source§

fn clone(&self) -> Outputs<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Outputs<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> From<&Sender<T>> for Outputs<T>

Source§

fn from(input: &Sender<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Sender<T>> for Outputs<T>

Source§

fn from(input: Sender<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> MaybeLabeled for Outputs<T>

Source§

fn label(&self) -> Option<Cow<'_, str>>

Returns the human-readable label, if any, of the object.
Source§

fn is_labeled(&self) -> bool

Checks whether the object has a human-readable label.
Source§

impl<T> MaybeNamed for Outputs<T>

Source§

fn name(&self) -> Option<Cow<'_, str>>

Returns the name, if any, of the object.
Source§

fn is_named(&self) -> bool

Checks whether the object has a name.
Source§

impl<T: Send + 'static> OutputPort<T> for Outputs<T>

Source§

fn send<'life0, 'async_trait>( &'life0 self, value: T, ) -> Pin<Box<dyn Future<Output = Result<(), SendError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl<T> Port<T> for Outputs<T>

Source§

fn is_closed(&self) -> bool

Checks if a port is closed.
Source§

fn close(&mut self)

Closes the port without dropping it.
Source§

fn capacity(&self) -> Option<usize>

Returns the remaining buffer capacity of the connection.
Source§

fn max_capacity(&self) -> Option<usize>

Returns the maximum buffer capacity of the connection.

Auto Trait Implementations§

§

impl<T> Freeze for Outputs<T>

§

impl<T> RefUnwindSafe for Outputs<T>

§

impl<T> Send for Outputs<T>
where T: Send,

§

impl<T> Sync for Outputs<T>
where T: Send,

§

impl<T> Unpin for Outputs<T>

§

impl<T> UnwindSafe for Outputs<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.