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.

Should match the corresponding parse2::multiplicity::ObjectSetMethods::Each. (See MultiplicityMethods::Each for rationale.)

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".

Implementors§