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>
impl<T: Issuable> Receiver<T>
Sourcepub fn with<R>(&self, read: impl FnOnce(&T) -> R) -> Result<R>
pub fn with<R>(&self, read: impl FnOnce(&T) -> R) -> Result<R>
Read the value, or refuse as Gone/resource once it has closed.
Sourcepub fn guard(&self) -> Result<Guard<'_, T>>
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.