dasp_signal

Struct Fork

Source
pub struct Fork<S, D> { /* private fields */ }
Expand description

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§

Source§

impl<S, D> Fork<S, D>

Source

pub fn by_rc(self) -> (BranchRcA<S, D>, BranchRcB<S, D>)

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

Source

pub fn by_ref(&mut self) -> (BranchRefA<'_, S, D>, BranchRefB<'_, S, D>)

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§

Source§

impl<S: Clone, D: Clone> Clone for Fork<S, D>

Source§

fn clone(&self) -> Fork<S, D>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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