ItemObjectParseable

Trait ItemObjectParseable 

Source
pub trait ItemObjectParseable: Sized {
    // Required methods
    fn check_label(label: &str) -> Result<(), ErrorProblem>;
    fn from_bytes(input: &[u8]) -> Result<Self, ErrorProblem>;

    // Provided method
    fn from_bytes_option(input: Option<&[u8]>) -> Result<Self, ErrorProblem> { ... }
}
Available on crate feature parse2 only.
Expand description

A possibly-optional Object value that can appear in netdoc

Implemented for Option, so that field: Option<ObjectValue> allows parsing an optional object.

Required Methods§

Source

fn check_label(label: &str) -> Result<(), ErrorProblem>

Check that the Label is right

Source

fn from_bytes(input: &[u8]) -> Result<Self, ErrorProblem>

Convert the bytes of the Object (which was present) into the actual value

input has been base64-decoded.

Provided Methods§

Source

fn from_bytes_option(input: Option<&[u8]>) -> Result<Self, ErrorProblem>

Convert the bytes of the Object, if any, into the actual value

If there was an Object, input has been base64-decoded. If there was no Object, input is None.

The provided implementation considers a missing object to be an error.

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.

Implementations on Foreign Types§

Source§

impl ItemObjectParseable for PublicKey

Source§

fn check_label(label: &str) -> Result<(), EP>

Source§

fn from_bytes(input: &[u8]) -> Result<Self, EP>

Source§

impl<T: ItemObjectParseable> ItemObjectParseable for Option<T>

Source§

fn check_label(label: &str) -> Result<(), EP>

Source§

fn from_bytes(input: &[u8]) -> Result<Self, EP>

Source§

fn from_bytes_option(input: Option<&[u8]>) -> Result<Self, EP>

Implementors§