Skip to main content

With

Trait With 

Source
pub trait With<F> {
    // Required methods
    fn shape() -> Shape;
    fn read(v: &Value, cx: &mut Reader<'_>) -> Option<F>;
    fn write(f: &F) -> Value;

    // Provided methods
    fn absent() -> Option<F> { ... }
    fn skip(_f: &F) -> bool { ... }
}
Expand description

How a field of type F is read and written.

Required Methods§

Source

fn shape() -> Shape

Source

fn read(v: &Value, cx: &mut Reader<'_>) -> Option<F>

Source

fn write(f: &F) -> Value

Provided Methods§

Source

fn absent() -> Option<F>

The field’s value when it isn’t there (None: it’s required).

Source

fn skip(_f: &F) -> bool

Whether a struct leaves the field out.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl With<String> for TextOf

Source§

impl<F, W: With<F>> With<BTreeMap<String, F>> for Values<W>

Source§

impl<F, W: With<F>> With<Option<F>> for Opt<W>

Source§

impl<F, W: With<F>> With<Vec<F>> for List<W>

Source§

impl<F: Schema> With<F> for Plain

Source§

impl<K: Kinds> With<String> for RefTo<K>