pub struct UsbRetirement { /* private fields */ }Expand description
A particular DAC owner’s USB retirement, independent of other devices.
Implementations§
Source§impl UsbRetirement
impl UsbRetirement
Sourcepub fn wait(&self, timeout: Duration) -> bool
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 }Sourcepub fn routing_hand_back_report(&self) -> Result<Option<RoutingHandBackReport>>
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§
Auto Trait Implementations§
impl !RefUnwindSafe for UsbRetirement
impl !UnwindSafe for UsbRetirement
impl Forget for UsbRetirement
impl Freeze for UsbRetirement
impl Move for UsbRetirement
impl Send for UsbRetirement
impl Sync for UsbRetirement
impl Unpin for UsbRetirement
impl UnsafeUnpin for UsbRetirement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more