Skip to main content

HumusApiFormat

Trait HumusApiFormat 

Source
pub trait HumusApiFormat: Clone + Send {
    // Required methods
    fn get_name(&self) -> HumusFormatIdentifier;
    fn get_media_type(&self) -> Mime;
    fn from_name(name: &HumusFormatIdentifier) -> Option<Self>;
    fn get_all() -> Vec<Self>;
}
Expand description

Trait for types that describe the API format, that is managed by the application.

It is best implemented on an Enum type;

Required Methods§

Source

fn get_name(&self) -> HumusFormatIdentifier

Returns the name of the format

Source

fn get_media_type(&self) -> Mime

Returns the Mimetype that is expected for this output format.

Source

fn from_name(name: &HumusFormatIdentifier) -> Option<Self>

Constructs a view from its name.

Source

fn get_all() -> Vec<Self>

Returns a Vec of all variants for the purpose of enumerating them with their get_name() methods.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§