Skip to main content

CapturedArtifact

Struct CapturedArtifact 

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

Owned copy of one completed producer output, independent of later source replacement.

Keep this record alive through every use of Self::path. The copy is temporary rather than a reusable cache entry; ordinary Drop removes it. Self::retain explicitly transfers cleanup to the caller.

Implementations§

Source§

impl CapturedArtifact

Source

pub fn capture( source: &Path, parent: &Path, maximum_bytes: usize, ) -> Result<Self>

Capture an output synchronously before another producer can overwrite it.

The caller keeps the source stable during capture and selects the maximum readable byte count. Read/publication failures retain their typed causes inside the returned I/O error. Existing public destinations are untouched. Bytes stream through bounded scratch rather than a complete in-memory copy.

§Errors

Returns the source read/byte-limit, staging allocation or durable-write error. An unsuccessful capture performs best-effort staging cleanup.

Source

pub fn path(&self) -> &Path

Borrow the exact captured bytes while this record owns their lifetime.

Source

pub fn retain(self) -> PathBuf

Transfer the captured file and its staging child to caller-owned retention.

Unlike close or Drop, this keeps the exact captured bytes after this owner is consumed. The caller owns later cleanup of the returned path’s parent. Keep custody of those paths; this grants no cache or release admission.

Source

pub fn retain_to( self, destination: &Path, ) -> Result<PathBuf, CaptureRetentionError>

Retain the exact capture at a caller-selected destination.

Uses fs::rename semantics, including replacement of an existing destination when supported. The caller owns destination admission and later custody. Only the empty owned staging child is removed on success.

§Errors

Rename or cleanup failure reports the actual retained bytes and staging child. Neither failure deletes evidence or silently retries publication.

Source

pub fn close(self) -> Result<()>

Remove the captured output and its owned staging child, reporting cleanup failure.

§Errors

Returns the filesystem error if removing the owned child fails.

Trait Implementations§

Source§

impl Debug for CapturedArtifact

Source§

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

Formats the value using the given formatter. 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> 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> Same for T

Source§

type Output = T

Should always be Self
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.