Skip to main content

MultiplicityMethods

Trait MultiplicityMethods 

Source
pub trait MultiplicityMethods<'f>: Copy + Sized {
    type Each: Sized + 'f;
    type Field: Sized;

    // Required method
    fn iter_ordered(
        self,
        f: &'f Self::Field,
    ) -> impl Iterator<Item = &'f Self::Each> + 'f;

    // Provided methods
    fn selector(self) -> Self { ... }
    fn check_netdoc_encodable(self)
       where Self::Each: NetdocEncodable { ... }
    fn check_item_value_encodable(self)
       where Self::Each: ItemValueEncodable { ... }
    fn check_item_argument_encodable(self)
       where Self::Each: ItemArgument { ... }
    fn check_item_object_encodable(self)
       where Self::Each: ItemObjectEncodable { ... }
}
Expand description

Methods for handling some multiplicity of netdoc elements, during encoding

For use by macros.

Each multiplicity impl allows us to iterate over the element(s).

Methods are also provided for typechecking, which are used by the derive macro to produce reasonable error messages when a trait impl is missing.

Required Associated Types§

Source

type Each: Sized + 'f

The value for each thing.

Source

type Field: Sized

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

Required Methods§

Source

fn iter_ordered( self, f: &'f Self::Field, ) -> impl Iterator<Item = &'f Self::Each> + 'f

Yield the items, in a stable order

Provided Methods§

Source

fn selector(self) -> Self

Return the appropriate implementor of MultiplicityMethods

Source

fn check_netdoc_encodable(self)
where Self::Each: NetdocEncodable,

Cause a compiler error if the element is not NetdocEncodable

Source

fn check_item_value_encodable(self)
where Self::Each: ItemValueEncodable,

Cause a compiler error if the element is not ItemValueEncodable

Source

fn check_item_argument_encodable(self)
where Self::Each: ItemArgument,

Cause a compiler error if the element is not ItemArgument

Source

fn check_item_object_encodable(self)

Cause a compiler error if the element is not ItemObjectEncodable

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§