Skip to main content

FirstReads

Struct FirstReads 

Source
pub struct FirstReads { /* private fields */ }
Expand description

The first reads of a run: for each path whose first read or run of a regular file came before any write of that path in the run, the file’s FileMetadata at that moment, in sorted path order.

A tracer notes a file when the command opens it for reading or runs it, and the kernel’s loads of interpreters and loaders count as runs. It notes nothing for a path that the command wrote earlier in the run, for a path it already noted, and for a call that created or truncated the file, which writes it first.

Implementations§

Source§

impl FirstReads

Source

pub fn new() -> Self

No first reads.

Source

pub fn is_first(&self, path: &AbsolutePath, accesses: &Accesses) -> bool

Whether a read or run of path now would be its first read: the path has no note yet, and accesses, every access recorded earlier in the run, shows no write of it.

Source

pub fn note( &mut self, path: &AbsolutePath, metadata: FileMetadata, accesses: &Accesses, ) -> bool

Note metadata as the first-read metadata of path, which the command is reading or running now, when that is its first read by FirstReads::is_first; return whether it was noted.

Source

pub fn note_at(&mut self, path: &AbsolutePath, accesses: &Accesses) -> bool

Note the metadata of the regular file at path, read now with FileMetadata::at, under the rules of FirstReads::note; nothing is noted when path names no regular file. Return whether it was noted.

A tracer calls it when the command reads or runs path, before it records that access in accesses.

Source

pub fn get(&self, path: &AbsolutePath) -> Option<&FileMetadata>

The first-read metadata of path, if it was noted.

Source

pub fn len(&self) -> usize

The number of noted paths.

Source

pub fn is_empty(&self) -> bool

Whether no path was noted.

Source

pub fn iter(&self) -> Iter<'_, AbsolutePath, FileMetadata> ⓘ

The noted paths with their first-read metadata, in sorted path order.

Trait Implementations§

Source§

impl Clone for FirstReads

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 FirstReads

Source§

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

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

impl Default for FirstReads

Source§

fn default() -> Self

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

impl Eq for FirstReads

Source§

impl<'a> IntoIterator for &'a FirstReads

Source§

type IntoIter = Iter<'a, AbsolutePath, FileMetadata>

Which kind of iterator are we turning this into?
Source§

type Item = (&'a AbsolutePath, &'a FileMetadata)

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for FirstReads

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FirstReads

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> 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.