Trait FlacError

Source
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§

Source

fn as_any(&self) -> &dyn Any

  • This method allows the trait to be able to downcast to a specific error struct.
Source

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.
Source

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.
Source

fn get_function(&self) -> &'static str

  • On which function call to get the error. Also useful for addressing errors.
Source

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.

Provided Methods§

Source

fn format(&self, f: &mut Formatter<'_>) -> Result

  • The common formatter for the error.

Implementors§