Struct pica_record::matcher::field::ExistsMatcher
source · pub struct ExistsMatcher { /* private fields */ }
Expand description
A matcher that checks if a field exists.
Implementations§
source§impl ExistsMatcher
impl ExistsMatcher
sourcepub fn new(matcher: &str) -> Result<Self, ParseMatcherError>
pub fn new(matcher: &str) -> Result<Self, ParseMatcherError>
Creates a new ExistsMatcher.
§Errors
This function fails if the given expression is not a valid exists matcher.
§Example
use pica_record::matcher::field::ExistsMatcher;
let _matcher = ExistsMatcher::new("003@?")?;
let _matcher = ExistsMatcher::new("041[A@]?")?;
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::ExistsMatcher;
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 = ExistsMatcher::new("003@?")?;
assert!(matcher.is_match(&field, &options));
Trait Implementations§
source§impl Clone for ExistsMatcher
impl Clone for ExistsMatcher
source§fn clone(&self) -> ExistsMatcher
fn clone(&self) -> ExistsMatcher
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 ExistsMatcher
impl Debug for ExistsMatcher
source§impl Display for ExistsMatcher
impl Display for ExistsMatcher
source§impl PartialEq for ExistsMatcher
impl PartialEq for ExistsMatcher
impl StructuralPartialEq for ExistsMatcher
Auto Trait Implementations§
impl Freeze for ExistsMatcher
impl RefUnwindSafe for ExistsMatcher
impl Send for ExistsMatcher
impl Sync for ExistsMatcher
impl Unpin for ExistsMatcher
impl UnwindSafe for ExistsMatcher
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
)