pub struct AsyncTempFile { /* private fields */ }Expand description
A facade-owned asynchronous temporary file.
§Examples
This example uses an isolated in-memory provider fixture.
use qubit_fs::temp::TempOptions;
use qubit_fs::temp::TempResourceState;
let mut temporary = filesystem.create_temp_file(TempOptions::default()).await?;
temporary.cleanup().await?;
assert_eq!(TempResourceState::Cleaned, temporary.state());Implementations§
Source§impl AsyncTempFile
impl AsyncTempFile
Sourcepub const fn state(&self) -> TempResourceState
pub const fn state(&self) -> TempResourceState
Returns the current ownership lifecycle state.
§Returns
The handle’s current cleanup and publication state.
Sourcepub fn child(&self, component: &PathComponent) -> Path
pub fn child(&self, component: &PathComponent) -> Path
Returns one lexically safe child path.
Sourcepub fn descendant(&self, relative: &RelativePath) -> Path
pub fn descendant(&self, relative: &RelativePath) -> Path
Returns one lexically safe descendant path.
Sourcepub fn keep(&mut self) -> SpiFuture<'_, Result<PersistOutcome, PersistFailure>>
pub fn keep(&mut self) -> SpiFuture<'_, Result<PersistOutcome, PersistFailure>>
Asynchronously publishes this temporary resource to a generated target.
§Returns
A future resolving to the provider’s confirmed publication outcome.
§Errors
Resolves to an invalid-state error when the resource is no longer owned, or to the provider ownership-transfer failure. An invalid-state failure retains any previously confirmed publication target and recovery state.
Sourcepub fn persist<'a>(
&'a mut self,
target: &'a Path,
options: PersistOptions,
) -> SpiFuture<'a, Result<PersistOutcome, PersistFailure>>
pub fn persist<'a>( &'a mut self, target: &'a Path, options: PersistOptions, ) -> SpiFuture<'a, Result<PersistOutcome, PersistFailure>>
Asynchronously persists this resource to a validated destination.
§Parameters
target: Validated destination path.options: Persistence atomicity and publication requirements.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. Rejected repeated calls preserve the previously confirmed publication facts.