pub struct Entry { /* private fields */ }Expand description
Configuration entry for a specific set of file specs (i.e. globs).
Defines what text patterns (“needles”) are forbidden to occur in the files’ content, as well as those which are required to be present.
Implementations§
Source§impl Entry
impl Entry
pub fn new( specs: impl IntoIterator<Item = FileSpec>, forbid: impl IntoIterator<Item = Needle>, mandate: impl IntoIterator<Item = Needle>, ) -> Result<Self, EntryError>
Source§impl Entry
impl Entry
Sourcepub fn applies_to(&self, path: impl AsRef<Path>) -> bool
pub fn applies_to(&self, path: impl AsRef<Path>) -> bool
Check whether this Entry applies to the specified file path.
Sourcepub fn iter_forbidden_needles(&self) -> impl Iterator<Item = &Needle>
pub fn iter_forbidden_needles(&self) -> impl Iterator<Item = &Needle>
Iterate over forbidden needles in this entry.
Sourcepub fn forbidden_needle(&self, idx: usize) -> Option<&Needle>
pub fn forbidden_needle(&self, idx: usize) -> Option<&Needle>
Get a forbidden needle in this entry by index.
Sourcepub fn forbidden_needle_count(&self) -> usize
pub fn forbidden_needle_count(&self) -> usize
Count of forbidden/banned needles in this entry.
Sourcepub fn iter_mandated_needles(&self) -> impl Iterator<Item = &Needle>
pub fn iter_mandated_needles(&self) -> impl Iterator<Item = &Needle>
Iterate over mandates needles in this entry.
Sourcepub fn mandated_needle(&self, idx: usize) -> Option<&Needle>
pub fn mandated_needle(&self, idx: usize) -> Option<&Needle>
Get a mandated needle in this entry by index.
Sourcepub fn mandated_needle_count(&self) -> usize
pub fn mandated_needle_count(&self) -> usize
Count of mandated/required needles in this entry.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Entry
impl<'de> Deserialize<'de> for Entry
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 Extend<Entry> for Config
impl Extend<Entry> for Config
Source§fn extend<T: IntoIterator<Item = Entry>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Entry>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<Entry> for Config
impl FromIterator<Entry> for Config
impl StructuralPartialEq for Entry
Auto Trait Implementations§
impl Freeze for Entry
impl RefUnwindSafe for Entry
impl Send for Entry
impl Sync for Entry
impl Unpin for Entry
impl UnwindSafe for Entry
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more