Struct async_session_types::Chan
source · [−]pub struct Chan<P, E, R> { /* private fields */ }
Expand description
A session typed channel. P
is the protocol and E
is the environment,
containing potential recursion targets. R
is the representation of
messages, which could be DynMessage
, or perhaps something we know
statically how to turn into JSON or bytes.
Implementations
sourceimpl<E, R> Chan<Eps, E, R>
impl<E, R> Chan<Eps, E, R>
sourcepub fn close(self) -> SessionResult<()>
pub fn close(self) -> SessionResult<()>
Close a channel. Should always be used at the end of your program.
sourceimpl<P, E, T, R: Repr<T>> Chan<Send<T, P>, E, R>
impl<P, E, T, R: Repr<T>> Chan<Send<T, P>, E, R>
sourcepub fn send(self, v: T) -> SessionResult<Chan<P, E, R>>
pub fn send(self, v: T) -> SessionResult<Chan<P, E, R>>
Send a value of type T
over the channel. Returns a channel with protocol P
.
sourceimpl<P: Outgoing, Q: Outgoing, E, R> Chan<Choose<P, Q>, E, R>
impl<P: Outgoing, Q: Outgoing, E, R> Chan<Choose<P, Q>, E, R>
sourceimpl<P: Incoming, Q: Incoming, E, R> Chan<Offer<P, Q>, E, R> where
P::Expected: 'static,
R: Repr<P::Expected>,
impl<P: Incoming, Q: Incoming, E, R> Chan<Offer<P, Q>, E, R> where
P::Expected: 'static,
R: Repr<P::Expected>,
sourcepub async fn offer(
self,
t: Duration
) -> SessionResult<Branch<Chan<P, E, R>, Chan<Q, E, R>>>
pub async fn offer(
self,
t: Duration
) -> SessionResult<Branch<Chan<P, E, R>, Chan<Q, E, R>>>
Passive choice. This allows the other end of the channel to select one
of two options for continuing the protocol: either P
or Q
.
Both options mean they will have to send a message to us,
the agency is on their side.
Trait Implementations
Auto Trait Implementations
impl<P, E, R> !RefUnwindSafe for Chan<P, E, R>
impl<P, E, R> Send for Chan<P, E, R> where
E: Send,
P: Send,
R: Send,
impl<P, E, R> Sync for Chan<P, E, R> where
E: Sync,
P: Sync,
R: Send + Sync,
impl<P, E, R> Unpin for Chan<P, E, R> where
E: Unpin,
P: Unpin,
R: Unpin,
impl<P, E, R> !UnwindSafe for Chan<P, E, R>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more