pub struct Error { /* private fields */ }
Implementations§
source§impl Error
impl Error
pub fn error() -> Error
pub fn invalid_format() -> Error
pub fn invalid_parameter() -> Error
pub fn not_supported() -> Error
pub fn from_raw(code: i32) -> Error
sourcepub fn code(&self) -> ErrorCode
pub fn code(&self) -> ErrorCode
Examples found in repository?
examples/devices.rs (line 98)
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
fn main() {
let ctx = common::init("Cubeb audio test").expect("Failed to create cubeb context");
println!("Enumerating input devices for backend {}", ctx.backend_id());
let devices = match ctx.enumerate_devices(DeviceType::INPUT) {
Ok(devices) => devices,
Err(e) if e.code() == cubeb::ErrorCode::NotSupported => {
println!("Device enumeration not support for this backend.");
return;
}
Err(e) => {
println!("Error enumerating devices: {}", e);
return;
}
};
println!("Found {} input devices", devices.len());
for d in devices.iter() {
print_device_info(d);
}
println!(
"Enumerating output devices for backend {}",
ctx.backend_id()
);
let devices = match ctx.enumerate_devices(DeviceType::OUTPUT) {
Ok(devices) => devices,
Err(e) => {
println!("Error enumerating devices: {}", e);
return;
}
};
println!("Found {} output devices", devices.len());
for d in devices.iter() {
print_device_info(d);
}
}
pub fn raw_code(&self) -> i32
Trait Implementations§
source§impl Error for Error
impl Error for Error
source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
source§impl PartialEq for Error
impl PartialEq for Error
impl Copy for Error
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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