[][src]Struct dasp_signal::Fork

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.

Implementations

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

pub fn by_rc(self) -> (BranchRcA<S, D>, BranchRcB<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

pub fn by_ref(&mut self) -> (BranchRefA<S, D>, BranchRefB<S, D>)[src]

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]

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<S, T> Duplex<S> for T where
    T: FromSample<S> + ToSample<S>, 
[src]

impl<T> From<T> for T[src]

impl<S> FromSample<S> for S[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> ToSample<U> for T where
    U: FromSample<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.