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<()>