Skip to main content

AsyncTempDirectory

Struct AsyncTempDirectory 

Source
pub struct AsyncTempDirectory(/* private fields */);
Expand description

A facade-owned asynchronous temporary directory.

§Examples

use qubit_fs::temp::{TempOptions, TempResourceState};

let mut temporary = filesystem.create_temp_directory(TempOptions::default()).await?;
temporary.cleanup().await?;
assert_eq!(TempResourceState::Cleaned, temporary.state());

Implementations§

Source§

impl AsyncTempDirectory

Source

pub const fn path(&self) -> &Path

Returns the provider-local temporary path.

§Returns

The validated path supplied by the provider.

Source

pub const fn state(&self) -> TempResourceState

Returns the current ownership lifecycle state.

§Returns

The handle’s current cleanup and publication state.

Source

pub fn child(&self, component: &PathComponent) -> Path

Returns one lexically safe child path.

Source

pub fn descendant(&self, relative: &RelativePath) -> Path

Returns one lexically safe descendant path.

Source

pub fn cleanup(&mut self) -> SpiFuture<'_, FsResult<()>>

Asynchronously confirms cleanup of this temporary directory.

§Returns

A future resolving after provider cleanup is confirmed.

§Errors

Resolves to an invalid-state error when cleanup is no longer legal, or to the provider cleanup failure.

Source

pub fn keep(&mut self) -> SpiFuture<'_, Result<PersistOutcome, PersistFailure>>

Asynchronously publishes this directory to a generated target.

§Returns

A future resolving to the confirmed publication outcome.

§Errors

Resolves to an invalid-state error when the directory is no longer owned, or to the provider ownership-transfer failure.

Source

pub fn persist<'a>( &'a mut self, target: &'a Path, options: PersistOptions, ) -> SpiFuture<'a, Result<PersistOutcome, PersistFailure>>

Asynchronously persists this directory to a validated destination.

§Parameters
  • target: Validated destination path.
  • options: Persistence atomicity and publication requirements.
§Returns

A future resolving to the confirmed persistence outcome.

§Errors

Resolves to a typed failure for invalid lifecycle state, failed local preflight, provider failure, or provider contract violation.

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