Struct SpooledTempFile
pub struct SpooledTempFile { /* private fields */ }
An object that behaves like a regular temporary file, but keeps data in memory until it reaches a configured size, at which point the data is written to a temporary file on disk, and further operations use the file on disk.
Implementations
impl SpooledTempFile
fn new(max_size: usize) -> SpooledTempFileConstruct a new
SpooledTempFile.fn new_in<P: AsRef<Path>>(max_size: usize, dir: P) -> SpooledTempFileConstruct a new
SpooledTempFile, backed by a file in the specified directory.fn is_rolled(&self) -> boolReturns true if the file has been rolled over to disk.
fn roll(&mut self) -> Result<()>Rolls over to a file on disk, regardless of current size. Does nothing if already rolled over.
fn set_len(&mut self, size: u64) -> Result<(), Error>Truncate the file to the specified size.
fn into_inner(self) -> SpooledDataConsumes and returns the inner
SpooledDatatype.fn into_file(self) -> Result<File>Convert into a regular unnamed temporary file, writing it to disk if necessary.
Trait Implementations
impl Debug for SpooledTempFile
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Read for SpooledTempFile
fn read(&mut self, buf: &mut [u8]) -> Result<usize>fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>fn read_to_string(&mut self, buf: &mut String) -> Result<usize>fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
impl Seek for SpooledTempFile
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
impl Write for SpooledTempFile
fn write(&mut self, buf: &[u8]) -> Result<usize>fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>fn flush(&mut self) -> Result<()>
Auto Trait Implementations
impl Freeze for SpooledTempFile
impl RefUnwindSafe for SpooledTempFile
impl Send for SpooledTempFile
impl Sync for SpooledTempFile
impl Unpin for SpooledTempFile
impl UnsafeUnpin for SpooledTempFile
impl UnwindSafe for SpooledTempFile
Blanket Implementations
impl<T> Any for SpooledTempFile
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for SpooledTempFile
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for SpooledTempFile
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for SpooledTempFile
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for SpooledTempFile
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for SpooledTempFile
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for SpooledTempFile
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>