[][src]Struct dasp_signal::bus::Output

pub struct Output<S> where
    S: Signal
{ /* fields omitted */ }

An output node to which some signal S is Outputing its frames.

It may be more accurate to say that the Output "pull"s frames from the signal.

Required Features

  • When using dasp_signal, this item requires the bus feature to be enabled.
  • When using dasp, this item requires the signal-bus feature to be enabled.

Implementations

impl<S> Output<S> where
    S: Signal
[src]

pub fn pending_frames(&self) -> usize[src]

The number of frames that have been requested from the Signal S by some other Output that have not yet been requested by this Output.

This is useful when using an Output to "monitor" some signal, allowing the user to drain only frames that have already been requested by some other Output.

Example

use dasp_signal::{self as signal, Signal};
use dasp_signal::bus::SignalBus;

fn main() {
    let frames = [[0.1], [0.2], [0.3]];
    let bus = signal::from_iter(frames.iter().cloned()).bus();
    let signal = bus.send();
    let mut monitor = bus.send();
    assert_eq!(signal.take(3).collect::<Vec<_>>(), vec![[0.1], [0.2], [0.3]]);
    assert_eq!(monitor.pending_frames(), 3);
    assert_eq!(monitor.next(), [0.1]);
    assert_eq!(monitor.pending_frames(), 2);
}

Required Features

  • When using dasp_signal, this item requires the bus feature to be enabled.
  • When using dasp, this item requires the signal-bus feature to be enabled.

Trait Implementations

impl<S> Drop for Output<S> where
    S: Signal
[src]

impl<S> Signal for Output<S> where
    S: Signal
[src]

type Frame = S::Frame

The Frame type returned by the Signal.

Auto Trait Implementations

impl<S> !RefUnwindSafe for Output<S>

impl<S> !Send for Output<S>

impl<S> !Sync for Output<S>

impl<S> Unpin for Output<S>

impl<S> !UnwindSafe for Output<S>

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> SignalBus for T where
    T: Signal
[src]

impl<T> SignalEnvelope for T where
    T: Signal
[src]

impl<T> SignalRms for T where
    T: Signal
[src]

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.