Skip to main content

Format

Trait Format 

Source
pub trait Format: Send + Sync {
    // Required methods
    fn extensions(&self) -> &'static [&'static str];
    fn parse<T: DeserializeOwned>(&self, input: &[u8]) -> Result<T, FmtError>;
}
Expand description

Abstract format parser that converts bytes into a structured object.

Note: This trait is not object-safe due to the generic parse method. Use format::AnyFormat for dynamic dispatch.

Required Methods§

Source

fn extensions(&self) -> &'static [&'static str]

List of supported extensions or identifiers.

Source

fn parse<T: DeserializeOwned>(&self, input: &[u8]) -> Result<T, FmtError>

Parse the raw bytes into the target type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§