Struct sample::signal::Fork[][src]

pub struct Fork<S, D> { /* fields omitted */ }

Represents a forked Signal that has not yet been split into its two branches.

A Fork can be split into its two branches via either of the following methods:

  • fork.by_rc(): consumes self and shares the fork via Rc<RefCell>.
  • fork.by_ref(): borrows self and shares the fork via &RefCell.

Methods

impl<S, D> Fork<S, D>
[src]

Consumes the Fork and returns two branches that share the signal and inner ring buffer via a reference countered pointer (Rc).

Note: This requires dynamical allocation as Rc<RefCell<Self>> is used to share the signal and ring buffer. A user may avoid this dynamic allocation by using the Fork::by_ref method instead, however this comes with the ergonomic cost of bounding the lifetime of the branches to the lifetime of the fork. Fork::by_ref

Mutably borrows the Fork and returns two branches that share the signal and inner ring buffer via reference.

This is more efficient than Fork::by_rc as it does not require Rc, however it may be less ergonomic in some cases as the returned branches are bound to the lifetime of Fork.

Trait Implementations

impl<S: Clone, D: Clone> Clone for Fork<S, D>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<S, D> Send for Fork<S, D> where
    D: Send,
    S: Send

impl<S, D> !Sync for Fork<S, D>