pub enum MapPattern {
Any,
Constraints(Vec<(Pattern, Pattern)>),
Length(Interval),
}
Expand description
Pattern for matching CBOR map structures.
Variants§
Any
Matches any map.
Constraints(Vec<(Pattern, Pattern)>)
Matches maps with multiple key-value constraints that must all be satisfied.
Length(Interval)
Matches maps with number of key-value pairs in the given interval.
Implementations§
Source§impl MapPattern
impl MapPattern
Sourcepub fn with_key_value_constraints(constraints: Vec<(Pattern, Pattern)>) -> Self
pub fn with_key_value_constraints(constraints: Vec<(Pattern, Pattern)>) -> Self
Creates a new MapPattern
that matches maps with multiple key-value
constraints that must all be satisfied.
Sourcepub fn with_length(length: usize) -> Self
pub fn with_length(length: usize) -> Self
Creates a new MapPattern
that matches maps with a specific number of
key-value pairs.
Sourcepub fn with_length_range<R: RangeBounds<usize>>(range: R) -> Self
pub fn with_length_range<R: RangeBounds<usize>>(range: R) -> Self
Creates a new MapPattern
that matches maps with number of key-value
pairs in the given range.
Sourcepub fn with_length_interval(interval: Interval) -> Self
pub fn with_length_interval(interval: Interval) -> Self
Creates a new MapPattern
that matches maps with number of key-value
pairs in the given range.
Trait Implementations§
Source§impl Clone for MapPattern
impl Clone for MapPattern
Source§fn clone(&self) -> MapPattern
fn clone(&self) -> MapPattern
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 MapPattern
impl Debug for MapPattern
Source§impl Display for MapPattern
impl Display for MapPattern
Source§impl PartialEq for MapPattern
impl PartialEq for MapPattern
impl Eq for MapPattern
impl StructuralPartialEq for MapPattern
Auto Trait Implementations§
impl Freeze for MapPattern
impl RefUnwindSafe for MapPattern
impl Send for MapPattern
impl Sync for MapPattern
impl Unpin for MapPattern
impl UnwindSafe for MapPattern
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