Skip to main content

OptionalityMethods

Trait OptionalityMethods 

Source
pub trait OptionalityMethods: Copy + Sized {
    type Each: Sized + 'static;
    type Field: Sized;

    // Required method
    fn as_option<'f>(self, f: &'f Self::Field) -> Option<&'f Self::Each>;
}
Expand description

Methods for handling optionality of a netdoc Object, during encoding

For use by macros.

Each impl allows us to visit an optional element.

Required Associated Types§

Source

type Each: Sized + 'static

The possibly-present element.

Source

type Field: Sized

The input type: the type of the field in the item struct.

Required Methods§

Source

fn as_option<'f>(self, f: &'f Self::Field) -> Option<&'f Self::Each>

Yield the element, if there is one

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.

Implementors§