pub enum SelectionConstraint {
Always,
Never,
RequireAll {
items: BTreeSet<SelectionItem>,
},
RequireAny {
items: BTreeSet<SelectionItem>,
},
ForbidAll {
items: BTreeSet<SelectionItem>,
},
MinSize {
n: u32,
},
MaxSize {
n: u32,
},
And {
children: Vec<Self>,
},
Or {
children: Vec<Self>,
},
Not {
child: Box<Self>,
},
}Expand description
Constraint over a selection value (an ordered set of items).
Variants§
Always
Always satisfied.
Never
Never satisfied.
RequireAll
Every required item must be selected.
Fields
§
items: BTreeSet<SelectionItem>The items that must all be present.
RequireAny
At least one required item must be selected.
Fields
§
items: BTreeSet<SelectionItem>The items — at least one must be present.
ForbidAll
None of these items may be selected.
Fields
§
items: BTreeSet<SelectionItem>The forbidden items.
MinSize
selection.len() >= n.
MaxSize
selection.len() <= n.
And
All children must hold.
Or
At least one child must hold.
Not
Child must not hold.
Implementations§
Source§impl SelectionConstraint
impl SelectionConstraint
Sourcepub fn test(&self, selection: &IndexSet<SelectionItem>) -> bool
pub fn test(&self, selection: &IndexSet<SelectionItem>) -> bool
Test a candidate selection.
Sourcepub fn canonicalize(self) -> Self
pub fn canonicalize(self) -> Self
Same rule set as IntConstraint::canonicalize.
Sourcepub fn canonical_bytes(&self) -> Vec<u8> ⓘ
pub fn canonical_bytes(&self) -> Vec<u8> ⓘ
Canonical byte form of this constraint as written.
Sourcepub fn fingerprint(&self) -> Fingerprint
pub fn fingerprint(&self) -> Fingerprint
Canonical fingerprint — auto-canonicalises first.
Trait Implementations§
Source§impl Clone for SelectionConstraint
impl Clone for SelectionConstraint
Source§fn clone(&self) -> SelectionConstraint
fn clone(&self) -> SelectionConstraint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SelectionConstraint
impl Debug for SelectionConstraint
Source§impl<'de> Deserialize<'de> for SelectionConstraint
impl<'de> Deserialize<'de> for SelectionConstraint
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for SelectionConstraint
impl Hash for SelectionConstraint
Source§impl Not for SelectionConstraint
impl Not for SelectionConstraint
Source§impl PartialEq for SelectionConstraint
impl PartialEq for SelectionConstraint
Source§impl Serialize for SelectionConstraint
impl Serialize for SelectionConstraint
impl Eq for SelectionConstraint
impl StructuralPartialEq for SelectionConstraint
Auto Trait Implementations§
impl Freeze for SelectionConstraint
impl RefUnwindSafe for SelectionConstraint
impl Send for SelectionConstraint
impl Sync for SelectionConstraint
impl Unpin for SelectionConstraint
impl UnsafeUnpin for SelectionConstraint
impl UnwindSafe for SelectionConstraint
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
Mutably borrows from an owned value. Read more
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
Compare self to
key and return true if they are equal.