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§
Required Methods§
Sourcefn iter_ordered(
self,
f: &'f Self::Field,
) -> impl Iterator<Item = &'f Self::Each> + 'f
fn iter_ordered( self, f: &'f Self::Field, ) -> impl Iterator<Item = &'f Self::Each> + 'f
Yield the items, in a stable order
Provided Methods§
Sourcefn check_netdoc_encodable(self)where
Self::Each: NetdocEncodable,
fn check_netdoc_encodable(self)where
Self::Each: NetdocEncodable,
Cause a compiler error if the element is not NetdocEncodable
Sourcefn check_item_value_encodable(self)where
Self::Each: ItemValueEncodable,
fn check_item_value_encodable(self)where
Self::Each: ItemValueEncodable,
Cause a compiler error if the element is not ItemValueEncodable
Sourcefn check_item_argument_encodable(self)where
Self::Each: ItemArgument,
fn check_item_argument_encodable(self)where
Self::Each: ItemArgument,
Cause a compiler error if the element is not ItemArgument
Sourcefn check_item_object_encodable(self)where
Self::Each: ItemObjectEncodable,
fn check_item_object_encodable(self)where
Self::Each: ItemObjectEncodable,
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.