Trait TryAsFormat

Source
pub trait TryAsFormat<D> {
    type Error;

    // Required method
    fn try_as_format(&self) -> Result<&D, Self::Error>;
}
Expand description

A thing that might contain data with a specific format D.

This trait is mainly intended for use with the enums auto-generated for Codas

Required Associated Types§

Source

type Error

Type of error returned when self doesn’t contain data of format D.

This error should be the ordinal identifier of the actual data in D, or Infallible.

Required Methods§

Source

fn try_as_format(&self) -> Result<&D, Self::Error>

Returns a D-formatted reference to the data.

Implementors§

Source§

impl<T> TryAsFormat<T> for T

Every data format can be interpreted as itself.