Skip to main content

ItemSource

Trait ItemSource 

Source
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§

Source

fn item_collection(&self, field: &'static str) -> ItemCollection

The first page of items with their labels.

Source

fn item_presence(&self) -> usize

1 when there is an item, 0 when there is none.

Source

fn label_of_item(&self, id: &Id) -> Option<String>

The label of the item id, when there is one.

Source

fn item_texts(&self, field: &'static str, found: &mut Vec<ItemText>)

The labelled items with all their text, for search.

Source

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

Implementors§