Skip to main content

Receiver

Struct Receiver 

Source
pub struct Receiver<T> { /* private fields */ }
Expand description

The implicit self of one call, read as the value a native exporter issued it from. The call pins the value, so the receiver reads it across awaits within the call. It cannot extend the value’s life: retained beyond the call, it reads while an owner lives and answers Gone/resource once the last owner or the issuing object has closed the value.

Implementations§

Source§

impl<T: Issuable> Receiver<T>

Source

pub fn with<R>(&self, read: impl FnOnce(&T) -> R) -> Result<R>

Read the value, or refuse as Gone/resource once it has closed.

Source

pub fn guard(&self) -> Result<Guard<'_, T>>

Hold the value for the rest of the call, for a method that awaits: the guard reads as the value and keeps it alive while held, so a &T borrowed from it stays valid across the method’s awaits, as a component’s &self does while its method is suspended. Held by the method’s future, it lasts until the call ends, also when the issuing object is reloaded or released meanwhile. A value that has closed is refused as Gone/resource.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Receiver<T>

§

impl<T> !Send for Receiver<T>

§

impl<T> !Sync for Receiver<T>

§

impl<T> !UnwindSafe for Receiver<T>

§

impl<T> Forget for Receiver<T>

§

impl<T> Freeze for Receiver<T>
where *const RcInner<Issuer> is !null: Freeze, PhantomData<T>: Freeze,

§

impl<T> Move for Receiver<T>

§

impl<T> Unpin for Receiver<T>
where T: Unpin, *const RcInner<Issuer> is !null: Unpin,

§

impl<T> UnsafeUnpin for Receiver<T>
where *const RcInner<Issuer> is !null: UnsafeUnpin, PhantomData<T>: UnsafeUnpin,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.