pub enum SelectionDomain {
Fixed {
values: IndexSet<SelectionItem>,
max_selections: u32,
},
External {
resolver: ResolverId,
max_selections: u32,
},
}Expand description
Selection domain: a set the user can pick multiple items from.
Variants§
Fixed
The available items are enumerated inline.
Fields
values: IndexSet<SelectionItem>The available items, in authored order.
External
The available items come from an external resolver looked up by id at plan-compilation time.
Fields
resolver: ResolverIdOpaque resolver id for the registry.
Implementations§
Source§impl SelectionDomain
impl SelectionDomain
Sourcepub fn fixed(
values: IndexSet<SelectionItem>,
max_selections: u32,
) -> Result<Self>
pub fn fixed( values: IndexSet<SelectionItem>, max_selections: u32, ) -> Result<Self>
Construct a fixed selection domain. Rejects empty value sets or
zero max_selections.
Sourcepub fn external(resolver: ResolverId, max_selections: u32) -> Result<Self>
pub fn external(resolver: ResolverId, max_selections: u32) -> Result<Self>
Construct an external selection domain.
Sourcepub const fn max_selections(&self) -> u32
pub const fn max_selections(&self) -> u32
Maximum number of items selectable at once.
Sourcepub fn contains_items_fixed(&self, items: &IndexSet<SelectionItem>) -> bool
pub fn contains_items_fixed(&self, items: &IndexSet<SelectionItem>) -> bool
Membership test: every item in items must be a legal
member. For External variants, legality can only be confirmed
through the resolver — Domain::contains handles that case by
degrading to shape-only checks.
Sourcepub fn cardinality(&self) -> Cardinality
pub fn cardinality(&self) -> Cardinality
Available-item count for the Fixed variant.
Sourcepub fn boundaries_fixed(&self) -> Vec<IndexSet<SelectionItem>>
pub fn boundaries_fixed(&self) -> Vec<IndexSet<SelectionItem>>
Single-item selections at the first and last boundary items.
Sourcepub fn sample_fixed<R: Rng + ?Sized>(
&self,
rng: &mut R,
) -> IndexSet<SelectionItem>
pub fn sample_fixed<R: Rng + ?Sized>( &self, rng: &mut R, ) -> IndexSet<SelectionItem>
Sample a random subset of size 1..=max_selections.
§Panics
Panics on SelectionDomain::External — registry-aware sampling
is a future slice; see module docs.
Trait Implementations§
Source§impl Clone for SelectionDomain
impl Clone for SelectionDomain
Source§fn clone(&self) -> SelectionDomain
fn clone(&self) -> SelectionDomain
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SelectionDomain
impl Debug for SelectionDomain
Source§impl<'de> Deserialize<'de> for SelectionDomain
impl<'de> Deserialize<'de> for SelectionDomain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SelectionDomain
impl PartialEq for SelectionDomain
Source§impl Serialize for SelectionDomain
impl Serialize for SelectionDomain
impl Eq for SelectionDomain
impl StructuralPartialEq for SelectionDomain
Auto Trait Implementations§
impl Freeze for SelectionDomain
impl RefUnwindSafe for SelectionDomain
impl Send for SelectionDomain
impl Sync for SelectionDomain
impl Unpin for SelectionDomain
impl UnsafeUnpin for SelectionDomain
impl UnwindSafe for SelectionDomain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.