Type Definition shared_files::SharedTemporaryFile

source ·
pub type SharedTemporaryFile = SharedFile<TempFile>;
Available on crate feature async-tempfile only.
Expand description

A type alias for a SharedFile wrapping a TempFile.

Implementations§

source§

impl SharedTemporaryFile

source

pub async fn new_with_uuid(uuid: Uuid) -> Result<Self, Error>

Creates a new temporary file in the default location. Convenience wrapper around TempFile::new_with_uuid and SharedFile::from.

Arguments
  • uuid - A UUID to use as a suffix to the file name.
source

pub async fn from_existing( path: PathBuf, ownership: Ownership ) -> Result<SharedFile<TempFile>, Error>

Wraps a new instance of this type around an existing file. This is a convenience wrapper around TempFile::from_existing and SharedFile::from.

If ownership is set to Ownership::Borrowed, this method does not take ownership of the file, i.e. the file will not be deleted when the instance is dropped.

Arguments
  • path - The path of the file to wrap.
  • ownership - The ownership of the file.
source

pub fn file_path(&self) -> &PathBuf

Returns the path of the underlying temporary file.