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