pub enum Error {
WouldBlock,
Stopped,
Disconnected(String),
InvalidConfig(String),
Backend(Box<dyn StdError + Send + Sync>),
}Expand description
Streaming-specific error type.
This error type is designed for the streaming API and includes variants that enforce the uniform backpressure contract across all backends.
Variants§
WouldBlock
The device/library cannot accept more data right now.
Stopped
The stream was explicitly stopped via StreamControl::stop().
Disconnected(String)
The device disconnected or became unreachable.
InvalidConfig(String)
Invalid configuration or API misuse.
Backend(Box<dyn StdError + Send + Sync>)
Backend/protocol error (wrapped).
Implementations§
Source§impl Error
impl Error
Sourcepub fn disconnected(msg: impl Into<String>) -> Self
pub fn disconnected(msg: impl Into<String>) -> Self
Create a disconnected error with a message.
Sourcepub fn invalid_config(msg: impl Into<String>) -> Self
pub fn invalid_config(msg: impl Into<String>) -> Self
Create an invalid config error with a message.
Sourcepub fn backend(err: impl StdError + Send + Sync + 'static) -> Self
pub fn backend(err: impl StdError + Send + Sync + 'static) -> Self
Create a backend error from any error type.
Sourcepub fn is_would_block(&self) -> bool
pub fn is_would_block(&self) -> bool
Returns true if this is a WouldBlock error.
Sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Returns true if this is a Disconnected error.
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Returns true if this is a Stopped error.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
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