pub trait ItemSource {
// Required methods
fn item_collection(&self, field: &'static str) -> ItemCollection;
fn item_presence(&self) -> usize;
fn label_of_item(&self, id: &Id) -> Option<String>;
fn item_texts(&self, field: &'static str, found: &mut Vec<ItemText>);
fn nested_items(&self, field: &'static str, out: &mut Vec<ItemCollection>);
}Expand description
A collection field’s items as #[derive(Model)] publishes them: written
with plain loops, once per item type, so a record’s derived code calls
these rather than repeating iterator chains per field.
Required Methods§
Sourcefn item_collection(&self, field: &'static str) -> ItemCollection
fn item_collection(&self, field: &'static str) -> ItemCollection
The first page of items with their labels.
Sourcefn item_presence(&self) -> usize
fn item_presence(&self) -> usize
1 when there is an item, 0 when there is none.
Sourcefn label_of_item(&self, id: &Id) -> Option<String>
fn label_of_item(&self, id: &Id) -> Option<String>
The label of the item id, when there is one.
Sourcefn item_texts(&self, field: &'static str, found: &mut Vec<ItemText>)
fn item_texts(&self, field: &'static str, found: &mut Vec<ItemText>)
The labelled items with all their text, for search.
Sourcefn nested_items(&self, field: &'static str, out: &mut Vec<ItemCollection>)
fn nested_items(&self, field: &'static str, out: &mut Vec<ItemCollection>)
The collections inside the first page of items, placed within them.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".