Struct SpooledTempFile

struct SpooledTempFile { ... }

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

Construct a new SpooledTempFile.

fn new_in<P: AsRef<Path>>(max_size: usize, dir: P) -> SpooledTempFile

Construct a new SpooledTempFile, backed by a file in the specified directory.

fn is_rolled(self: &Self) -> bool

Returns true if the file has been rolled over to disk.

fn roll(self: &mut Self) -> Result<()>

Rolls over to a file on disk, regardless of current size. Does nothing if already rolled over.

fn set_len(self: &mut Self, size: u64) -> Result<(), Error>

Truncate the file to the specified size.

fn into_inner(self: Self) -> SpooledData

Consumes and returns the inner SpooledData type.

fn into_file(self: Self) -> Result<File>

Convert into a regular unnamed temporary file, writing it to disk if necessary.

impl Debug for SpooledTempFile

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Freeze for SpooledTempFile

impl Read for SpooledTempFile

fn read(self: &mut Self, buf: &mut [u8]) -> Result<usize>
fn read_vectored(self: &mut Self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
fn read_to_end(self: &mut Self, buf: &mut Vec<u8>) -> Result<usize>
fn read_to_string(self: &mut Self, buf: &mut String) -> Result<usize>
fn read_exact(self: &mut Self, buf: &mut [u8]) -> Result<()>

impl RefUnwindSafe for SpooledTempFile

impl Seek for SpooledTempFile

fn seek(self: &mut Self, pos: SeekFrom) -> Result<u64>

impl Send for SpooledTempFile

impl Sync for SpooledTempFile

impl Unpin for SpooledTempFile

impl UnsafeUnpin for SpooledTempFile

impl UnwindSafe for SpooledTempFile

impl Write for SpooledTempFile

fn write(self: &mut Self, buf: &[u8]) -> Result<usize>
fn write_vectored(self: &mut Self, bufs: &[IoSlice<'_>]) -> Result<usize>
fn flush(self: &mut Self) -> Result<()>

impl<T> Any for SpooledTempFile

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for SpooledTempFile

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for SpooledTempFile

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for SpooledTempFile

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for SpooledTempFile

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for SpooledTempFile

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for SpooledTempFile

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>