Skip to main content

Fields

Trait Fields 

Source
pub trait Fields {
    // Required methods
    fn name(&self, index: usize) -> Option<&str>;
    fn get(&self, name: &str) -> Option<Shown<'_>>;

    // Provided method
    fn names(&self) -> Box<dyn Iterator<Item = &str> + '_> { ... }
}
Expand description

Named and ordered as the type’s JSON; #[derive(ReadModel)] writes them for a read model.

Required Methods§

Source

fn name(&self, index: usize) -> Option<&str>

Source

fn get(&self, name: &str) -> Option<Shown<'_>>

Provided Methods§

Source

fn names(&self) -> Box<dyn Iterator<Item = &str> + '_>

Overridden where name(index) walks from the start, so a walk over all fields stays linear.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Fields for Map<String, Value>

Source§

fn name(&self, index: usize) -> Option<&str>

Source§

fn get(&self, name: &str) -> Option<Shown<'_>>

Source§

fn names(&self) -> Box<dyn Iterator<Item = &str> + '_>

Implementors§