pub struct Protocol<P: 'static, S = Bincode> { /* private fields */ }
Expand description
A Protocol
is a specific type of Process
.
It uses session types to check during compile time that all messages exchanged between two processes are in the correct order and of the correct type.
Implementations
sourceimpl<P, A, S> Protocol<Send<A, P>, S>where
S: Serializer<A>,
impl<P, A, S> Protocol<Send<A, P>, S>where
S: Serializer<A>,
sourceimpl<P, A, S> Protocol<Recv<A, P>, S>where
S: Serializer<A>,
impl<P, A, S> Protocol<Recv<A, P>, S>where
S: Serializer<A>,
sourceimpl<A, S> Protocol<Recv<A, TaskEnd>, S>where
S: Serializer<A>,
impl<A, S> Protocol<Recv<A, TaskEnd>, S>where
S: Serializer<A>,
sourcepub fn result(self) -> A
pub fn result(self) -> A
A task is a special case of a protocol spawned with the spawn!(@task ...)
macro. It only returns one value.
sourcepub fn result_timeout(self, duration: Duration) -> MailboxResult<A>
pub fn result_timeout(self, duration: Duration) -> MailboxResult<A>
A task is a special case of a protocol spawned with the spawn!(@task ...)
macro. It only returns one value.
sourceimpl<P, Q, S> Protocol<Choose<P, Q>, S>where
S: Serializer<bool>,
impl<P, Q, S> Protocol<Choose<P, Q>, S>where
S: Serializer<bool>,
sourcepub fn select_left(self) -> Protocol<P, S>
pub fn select_left(self) -> Protocol<P, S>
Perform an active choice, selecting protocol P
.
sourcepub fn select_right(self) -> Protocol<Q, S>
pub fn select_right(self) -> Protocol<Q, S>
Perform an active choice, selecting protocol Q
.
Trait Implementations
Auto Trait Implementations
impl<P, S> RefUnwindSafe for Protocol<P, S>where
P: RefUnwindSafe,
S: RefUnwindSafe,
impl<P, S> Send for Protocol<P, S>where
P: Send,
S: Send,
impl<P, S> Sync for Protocol<P, S>where
P: Sync,
S: Sync,
impl<P, S> Unpin for Protocol<P, S>where
P: Unpin,
S: Unpin,
impl<P, S> UnwindSafe for Protocol<P, S>where
P: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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