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
Sourcepub fn descendant(&self, relative: &RelativePath) -> Path
pub fn descendant(&self, relative: &RelativePath) -> Path
Sourcepub fn cleanup(&mut self) -> SpiFuture<'_, FsResult<()>>
pub fn cleanup(&mut self) -> SpiFuture<'_, FsResult<()>>
Asynchronously confirms cleanup of this temporary resource.
Dropping an unpolled cleanup future changes nothing. Cancelling cleanup
after it returns Pending leaves source authority indeterminate while
preserving whether the target was already known to be published or not
published. Later persist or keep calls are rejected and retain that
distinction in their failure snapshot. This does not authorize another
source mutation.
§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.
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.
§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.