Skip to main content

CollectionExtract

Trait CollectionExtract 

Source
pub trait CollectionExtract<S>: Send + Sync {
    type Item;

    // Required methods
    fn extract<'s>(&self, s: &'s S) -> &'s [Self::Item];
    fn change_source(&self) -> ChangeSource;

    // Provided methods
    fn contains(&self, _s: &S, _item: &Self::Item) -> bool { ... }
    fn planning_id(&self, _item: &Self::Item) -> Option<String> { ... }
}
Expand description

Extracts a slice of entities from the solution.

The associated type Item names the entity type, allowing callers to write E: CollectionExtract<S, Item = A> when A must be inferred from E rather than stated as a separate generic parameter.

Required Associated Types§

Source

type Item

The entity type yielded by this extractor.

Required Methods§

Source

fn extract<'s>(&self, s: &'s S) -> &'s [Self::Item]

Extracts the entity slice from the solution.

Source

fn change_source(&self) -> ChangeSource

The descriptor that owns this source’s rows, or Static when no planning-variable change can alter them. Macro-generated solution source methods attach it through hidden internal support.

Provided Methods§

Source

fn contains(&self, _s: &S, _item: &Self::Item) -> bool

Reports whether this extractor’s own source-level predicate accepts an item.

Source

fn planning_id(&self, _item: &Self::Item) -> Option<String>

The planning id constraint analysis reports for item, rendered as described on EntityRef::planning_id. Read only while explaining a match, never while scoring. Planning-model entity and fact collections report their #[planning_id]; the default reports none.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S, A, E, F, Sc> CollectionExtract<S> for UniConstraintStream<S, A, E, F, Sc>
where S: Send + Sync + 'static, A: Send + Sync + 'static, E: CollectionExtract<S, Item = A>, F: UniFilter<S, A>, Sc: Score + 'static,

Source§

type Item = A