Struct pica_record::matcher::field::CardinalityMatcher
source · pub struct CardinalityMatcher { /* private fields */ }
Implementations§
source§impl CardinalityMatcher
impl CardinalityMatcher
sourcepub fn new(matcher: &str) -> Result<Self, ParseMatcherError>
pub fn new(matcher: &str) -> Result<Self, ParseMatcherError>
Creates a new CardinalityMatcher.
§Errors
This function fails if the given expression is not a valid singleton matcher.
§Example
use pica_record::matcher::field::CardinalityMatcher;
let _matcher = CardinalityMatcher::new("#010@{a == 'ger'} > 1")?;
let _matcher = CardinalityMatcher::new("#003@ > 1")?;
sourcepub fn is_match<'a>(
&self,
fields: impl IntoIterator<Item = &'a FieldRef<'a>>,
options: &MatcherOptions,
) -> bool
pub fn is_match<'a>( &self, fields: impl IntoIterator<Item = &'a FieldRef<'a>>, options: &MatcherOptions, ) -> bool
Returns true
if the matcher matches against the given
subfield(s).
§Example
use pica_record::matcher::field::CardinalityMatcher;
use pica_record::matcher::MatcherOptions;
use pica_record::primitives::FieldRef;
let field = FieldRef::new("003@", None, vec![('0', "123456789X")])?;
let options = MatcherOptions::default();
let matcher = CardinalityMatcher::new("#003@ == 1")?;
assert!(matcher.is_match(&field, &options));
Trait Implementations§
source§impl Clone for CardinalityMatcher
impl Clone for CardinalityMatcher
source§fn clone(&self) -> CardinalityMatcher
fn clone(&self) -> CardinalityMatcher
Returns a copy 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 CardinalityMatcher
impl Debug for CardinalityMatcher
source§impl Display for CardinalityMatcher
impl Display for CardinalityMatcher
source§impl PartialEq for CardinalityMatcher
impl PartialEq for CardinalityMatcher
impl StructuralPartialEq for CardinalityMatcher
Auto Trait Implementations§
impl Freeze for CardinalityMatcher
impl RefUnwindSafe for CardinalityMatcher
impl Send for CardinalityMatcher
impl Sync for CardinalityMatcher
impl Unpin for CardinalityMatcher
impl UnwindSafe for CardinalityMatcher
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)