Trait OptFields

Source
pub trait OptFields:
    Sized
    + Default
    + Clone {
    // Required methods
    fn fields(&self) -> &[OptElem];
    fn parse(input: Split<'_, &str>) -> Self;
    fn new() -> Self;
}
Expand description

Trait for OptFields

Required Methods§

Source

fn fields(&self) -> &[OptElem]

Return a slice over all optional fields. NB: This may be replaced by an iterator or something else in the future

Source

fn parse(input: Split<'_, &str>) -> Self

Given an iterator over a split, each expected to hold one optional field (in the :: format), parse them as optional fields to create a collection.

Source

fn new() -> Self

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 OptFields for ()

This implementation is useful for performance if we don’t actually need any optional fields. () takes up zero space, and all methods are no-ops.

Source§

fn fields(&self) -> &[OptElem]

Source§

fn parse(_input: Split<'_, &str>) -> Self

Source§

fn new() -> Self

Source§

impl OptFields for Vec<OptElem>

Stores all the optional fields in a vector.

Source§

fn fields(&self) -> &[OptElem]

Source§

fn parse(input: Split<'_, &str>) -> Self

Source§

fn new() -> Self

Implementors§