pub struct RefCountedTempFile { /* private fields */ }Expand description
A wrapper around a NamedTempFile that also contains
a reference to its parent temporary directory.
§Note
After any modification to the underlying file (e.g., writing data to it), the caller
must invoke Self::update_disk_usage to update the global disk usage counter.
This ensures the disk manager can properly enforce usage limits configured by
DiskManager::with_max_temp_directory_size.
Implementations§
Source§impl RefCountedTempFile
impl RefCountedTempFile
pub fn path(&self) -> &Path
pub fn inner(&self) -> &NamedTempFile
Sourcepub fn update_disk_usage(&mut self) -> Result<()>
pub fn update_disk_usage(&mut self) -> Result<()>
Updates the global disk usage counter after modifications to the underlying file.
§Errors
- Returns an error if the global disk usage exceeds the configured limit.
pub fn current_disk_usage(&self) -> u64
Trait Implementations§
Source§impl Debug for RefCountedTempFile
impl Debug for RefCountedTempFile
Auto Trait Implementations§
impl Freeze for RefCountedTempFile
impl !RefUnwindSafe for RefCountedTempFile
impl Send for RefCountedTempFile
impl Sync for RefCountedTempFile
impl Unpin for RefCountedTempFile
impl !UnwindSafe for RefCountedTempFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more