pub struct Child<P: Protocol> { /* private fields */ }Expand description
A protocol owned by another, with the inbox its indications are collected into.
Implementations§
Source§impl<P: Protocol> Child<P>
impl<P: Protocol> Child<P>
Source§impl<P> Child<P>
impl<P> Child<P>
Sourcepub fn run<M, I, Me, En>(
&mut self,
cx: &mut Cx<'_, M, I, P::Note, Me, En>,
wrap: impl Fn(P::Msg) -> M,
f: impl FnOnce(&mut P, &mut ProtoCx<'_, P>),
) -> Vec<P::Ind>
pub fn run<M, I, Me, En>( &mut self, cx: &mut Cx<'_, M, I, P::Note, Me, En>, wrap: impl Fn(P::Msg) -> M, f: impl FnOnce(&mut P, &mut ProtoCx<'_, P>), ) -> Vec<P::Ind>
Run f against the child, forwarding what it sends as wrap(msg) and returning what it
indicated for the parent to handle. Hand the returned inbox to Child::reclaim once done.
The child is handed no store — see Cx::with_child_consuming. A child that keeps
something durably is run with Child::run_durable instead.
Source§impl<P> Child<P>where
P: Protocol<Entry = Infallible>,
impl<P> Child<P>where
P: Protocol<Entry = Infallible>,
Sourcepub fn run_durable<M, I, Me, En>(
&mut self,
cx: &mut Cx<'_, M, I, P::Note, Me, En>,
wrap: impl Fn(P::Msg) -> M,
slot: Slot<Me, P::Meta>,
f: impl FnOnce(&mut P, &mut ProtoCx<'_, P>),
) -> Vec<P::Ind>
pub fn run_durable<M, I, Me, En>( &mut self, cx: &mut Cx<'_, M, I, P::Note, Me, En>, wrap: impl Fn(P::Msg) -> M, slot: Slot<Me, P::Meta>, f: impl FnOnce(&mut P, &mut ProtoCx<'_, P>), ) -> Vec<P::Ind>
Child::run, for a child that keeps durable metadata in slot of the parent’s record.
See Cx::with_durable_child_consuming for why the write is one and not two.
Source§impl<P: Protocol> Child<P>
impl<P: Protocol> Child<P>
Sourcepub fn run_keyed<M, I, Me, En, K>(
&mut self,
cx: &mut Cx<'_, M, I, P::Note, Me, En>,
wrap: impl Fn(P::Msg) -> M,
slot: KeyedSlot<Me, P::Meta, K>,
key: K,
f: impl FnOnce(&mut P, &mut ProtoCx<'_, P>),
) -> Vec<P::Ind>where
P: Protocol<Entry = Infallible>,
pub fn run_keyed<M, I, Me, En, K>(
&mut self,
cx: &mut Cx<'_, M, I, P::Note, Me, En>,
wrap: impl Fn(P::Msg) -> M,
slot: KeyedSlot<Me, P::Meta, K>,
key: K,
f: impl FnOnce(&mut P, &mut ProtoCx<'_, P>),
) -> Vec<P::Ind>where
P: Protocol<Entry = Infallible>,
Child::run_durable, for one member of a family of durable children.
Sourcepub fn run_appending<M, I, Me, En>(
&mut self,
cx: &mut Cx<'_, M, I, P::Note, Me, En>,
wrap: impl Fn(P::Msg) -> M,
slot: Slot<Me, P::Meta>,
entries: SeqSlot<En, P::Entry>,
f: impl FnOnce(&mut P, &mut ProtoCx<'_, P>),
) -> Vec<P::Ind>
pub fn run_appending<M, I, Me, En>( &mut self, cx: &mut Cx<'_, M, I, P::Note, Me, En>, wrap: impl Fn(P::Msg) -> M, slot: Slot<Me, P::Meta>, entries: SeqSlot<En, P::Entry>, f: impl FnOnce(&mut P, &mut ProtoCx<'_, P>), ) -> Vec<P::Ind>
Child::run_durable, for a child that keeps metadata and appends.
See Cx::with_durable_child: the child’s entries go into the parent’s one sequence, so
the order between a parent’s entry and its child’s is real rather than invented at recovery.
Trait Implementations§
Source§impl<P: Protocol + Debug> Debug for Child<P>
Shows the protocol. The inbox is empty between events, and its element type need not be
Debug for the parent to be.
impl<P: Protocol + Debug> Debug for Child<P>
Shows the protocol. The inbox is empty between events, and its element type need not be
Debug for the parent to be.
Auto Trait Implementations§
impl<P> Freeze for Child<P>where
P: Freeze,
impl<P> RefUnwindSafe for Child<P>
impl<P> Send for Child<P>
impl<P> Sync for Child<P>
impl<P> Unpin for Child<P>
impl<P> UnsafeUnpin for Child<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for Child<P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CryptoRng for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Renamed to random to avoid conflict with the new gen keyword in Rust 2024.
Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Renamed to random_range
Rng::random_range.impl<R> TryCryptoRng for R
Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
RngCore to a RngReadAdapter.