pub trait FlacError: Any {
// Required methods
fn as_any(&self) -> &dyn Any;
fn get_code(&self) -> u32;
fn get_message(&self) -> &'static str;
fn get_function(&self) -> &'static str;
fn get_message_from_code(&self) -> &'static str;
// Provided method
fn format(&self, f: &mut Formatter<'_>) -> Result { ... }
}
Expand description
§A trait for me to coveniently write FlacDecoderError
, FlacDecoderInitError
, FlacEncoderError
, FlacEncoderInitError
Not for you to use.
Required Methods§
Sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
- This method allows the trait to be able to downcast to a specific error struct.
Sourcefn get_code(&self) -> u32
fn get_code(&self) -> u32
- Get the error or status code from the error struct. The code depends on which type of the error struct.
Sourcefn get_message(&self) -> &'static str
fn get_message(&self) -> &'static str
- Get the message that describes the error code, mostly useful if you don’t know what exact the error type is.
Sourcefn get_function(&self) -> &'static str
fn get_function(&self) -> &'static str
- On which function call to get the error. Also useful for addressing errors.
Sourcefn get_message_from_code(&self) -> &'static str
fn get_message_from_code(&self) -> &'static str
- This function is implemented by the specific error struct, each struct has a different way to describe the code.