Skip to main content

RateContract

Struct RateContract 

Source
pub struct RateContract { /* private fields */ }
Expand description

Timing agreement a stream port advertises and must share to connect.

Pairs a ClockDomain with a LatencyClass and an optional nominal sample rate in hertz. Two ports may be wired together only when their contracts are compatible (see is_compatible_with).

Implementations§

Source§

impl RateContract

Source

pub fn new( clock_domain: ClockDomain, latency_class: LatencyClass, nominal_rate_hz: Option<u32>, ) -> Self

Builds a contract from an explicit clock domain, latency class, and optional nominal rate.

Source

pub fn sample_exact(nominal_rate_hz: Option<u32>) -> Self

Contract for sample-exact audio: sample clock domain, sample-exact latency, and the given nominal rate.

Source

pub fn block_local() -> Self

Contract for block-local processing: block clock domain and block-local latency, with no fixed nominal rate.

Source

pub fn control() -> Self

Contract for interactive control traffic: control clock domain and interactive latency.

Source

pub fn midi_tick() -> Self

Contract for MIDI-tick traffic: MIDI-tick clock domain and interactive latency.

Source

pub fn trace_step() -> Self

Contract for offline trace stepping: trace-step clock domain and offline-render latency.

Source

pub fn clock_domain(self) -> ClockDomain

Returns the clock domain this contract runs in.

Source

pub fn latency_class(self) -> LatencyClass

Returns the latency class this contract promises.

Source

pub fn nominal_rate_hz(self) -> Option<u32>

Returns the nominal sample rate in hertz, if one is fixed.

Source

pub fn is_compatible_with(self, other: Self) -> bool

Reports whether self and other may be connected.

Compatible means matching clock domain and latency class; nominal rates must agree only when both are fixed (an unset rate matches any rate).

Source

pub fn ensure_compatible(self, other: Self) -> Result<()>

Checks compatibility with other, returning a descriptive error when the two contracts cannot be connected.

Trait Implementations§

Source§

impl Clone for RateContract

Source§

fn clone(&self) -> RateContract

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for RateContract

Source§

impl Debug for RateContract

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RateContract

Source§

impl PartialEq for RateContract

Source§

fn eq(&self, other: &RateContract) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RateContract

Auto Trait Implementations§

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.