Skip to main content

UsbRetirement

Struct UsbRetirement 

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

A particular DAC owner’s USB retirement, independent of other devices.

Implementations§

Source§

impl UsbRetirement

Source

pub fn wait(&self, timeout: Duration) -> bool

Examples found in repository?
examples/two_dac_smoke.rs (line 137)
121    pub fn run() -> Result<(), Box<dyn std::error::Error>> {
122        let (first_fd, first, first_stream, first_original) = open("/dev/bus/usb/001/002")?;
123        let (second_fd, second, second_stream, second_original) = open("/dev/bus/usb/001/003")?;
124        feed(&[&first_stream, &second_stream], Duration::from_secs(2))?;
125        let a = first_stream.stats();
126        let b = second_stream.stats();
127        assert!(
128            a.played_frames > 20_000
129                && b.played_frames > 20_000
130                && a.lost_frames == 0
131                && b.lost_frames == 0
132        );
133        let second_level = volume(second_fd.as_raw_fd())?;
134        let first_retirement = first.retirement();
135        first_stream.close()?;
136        first.close()?;
137        assert!(first_retirement.wait(Duration::from_secs(2)));
138        assert_eq!(alternate(first_fd.as_raw_fd())?, 0);
139        assert_eq!(volume(first_fd.as_raw_fd())?, first_original);
140        assert_eq!(alternate(second_fd.as_raw_fd())?, 1);
141        assert_eq!(
142            volume(second_fd.as_raw_fd())?,
143            second_level,
144            "first close changed second volume"
145        );
146        feed(&[&second_stream], Duration::from_secs(1))?;
147        let after = second_stream.stats();
148        assert!(after.played_frames > b.played_frames && after.lost_frames == 0);
149        let second_retirement = second.retirement();
150        second_stream.close()?;
151        second.close()?;
152        assert!(second_retirement.wait(Duration::from_secs(2)));
153        assert_eq!(alternate(second_fd.as_raw_fd())?, 0);
154        assert_eq!(volume(second_fd.as_raw_fd())?, second_original);
155        release(&first_fd)?;
156        release(&second_fd)?;
157        println!("TWO_DACS_PASS first_frames={} second_frames={} independent volume/alt-zero/retirement/duplicate protection",a.played_frames,after.played_frames);
158        Ok(())
159    }
Source

pub fn routing_hand_back_report(&self) -> Result<Option<RoutingHandBackReport>>

Routing hand-back outcome after this owner has retired. None means no route changes were recorded; a pending owner is an explicit error.

Trait Implementations§

Source§

impl Clone for UsbRetirement

Source§

fn clone(&self) -> Self

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

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.