Skip to main content

IgnoreFile

Struct IgnoreFile 

Source
pub struct IgnoreFile {
    pub ignore: Vec<IgnoreEntry>,
}
Expand description

The suppressions a project has decided to keep.

Every operation that changes the file takes it by value and hands back the changed one, so a caller cannot half-apply a change and cannot be handed a file that something else is still writing to.

Fields§

§ignore: Vec<IgnoreEntry>

Implementations§

Source§

impl IgnoreFile

Source

pub fn path_in(root: &Path) -> PathBuf

Where the ignore file lives for a project root.

Source

pub fn load(root: &Path) -> Self

Read it, or an empty one if there is nothing readable there.

Unlike a baseline, an absent ignore file is the ordinary case: most projects suppress nothing, and that is indistinguishable from a project that has not started yet.

Source

pub fn save(&self, root: &Path) -> Result<()>

Write it to the project root, or take the file away when there is nothing left to record.

An empty suppression list makes exactly the claim that no suppression list makes, and load cannot tell them apart. cleanup pruning the last entry is the one path that produces one, and a file reading ignore = [] is residue rather than a record.

§Errors

Returns the I/O error if the file cannot be serialized, written or removed.

Source

pub fn remove_from(root: &Path) -> Result<()>

Take the ignore file away, and say nothing if it was not there.

§Errors

Returns the I/O error if the file exists and cannot be removed.

Source

pub fn with_ignored( self, fingerprint: &Fingerprint, reason: Option<String>, members: Vec<String>, ) -> Self

The same file with fingerprint suppressed, or unchanged if it already was.

Source

pub fn without(self, fingerprint: &str) -> (Self, bool)

The same file without fingerprint, and whether it was there to remove.

Source

pub fn contains(&self, fingerprint: &Fingerprint) -> bool

Whether this fingerprint is suppressed.

Source

pub fn retain_unsuppressed( &self, groups: Vec<DuplicateGroup>, ) -> Vec<DuplicateGroup>

The groups this file does not suppress.

Source

pub fn stale(&self, live: &HashSet<Fingerprint>) -> Vec<&IgnoreEntry>

The entries whose fingerprint no longer matches anything live.

An entry whose fingerprint is not valid hex is always stale: nothing this tool produces could match it.

Source

pub fn without_stale( self, live: &HashSet<Fingerprint>, ) -> (Self, Vec<IgnoreEntry>)

The same file with the stale entries taken out, and those entries.

Trait Implementations§

Source§

impl Clone for IgnoreFile

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IgnoreFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IgnoreFile

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for IgnoreFile

Source§

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 Serialize for IgnoreFile

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.