pub struct TempStorageProvider { /* private fields */ }
Available on crate feature
temp-storage
only.Expand description
Creates a TempStorageReader
backed by a temporary file
Implementations§
Source§impl TempStorageProvider
impl TempStorageProvider
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new TempStorageProvider
that creates temporary files in the OS-specific
default location.
Sourcepub fn new_in<T>(path: T) -> Self
pub fn new_in<T>(path: T) -> Self
Creates a new TempStorageProvider
that creates temporary files in the specified
location.
Sourcepub fn with_prefix<T>(prefix: T) -> Self
pub fn with_prefix<T>(prefix: T) -> Self
Creates a new TempStorageProvider
that creates temporary files using the specified
filename prefix.
Sourcepub fn with_prefix_in<S, P>(prefix: S, path: P) -> Self
pub fn with_prefix_in<S, P>(prefix: S, path: P) -> Self
Creates a new TempStorageProvider
that creates temporary files in the specified location
using the specified filename prefix.
Sourcepub fn with_tempfile_builder<F: Fn() -> Result<NamedTempFile> + Send + Sync + 'static>(
builder: F,
) -> Self
pub fn with_tempfile_builder<F: Fn() -> Result<NamedTempFile> + Send + Sync + 'static>( builder: F, ) -> Self
Creates a new TempStorageProvider
with a custom tempfile::NamedTempFile
builder.
§Example
use stream_download::storage::temp::{TempStorageProvider, tempfile};
TempStorageProvider::with_tempfile_builder(|| {
tempfile::Builder::new().suffix("testfile").tempfile()
});
Trait Implementations§
Source§impl Clone for TempStorageProvider
impl Clone for TempStorageProvider
Source§fn clone(&self) -> TempStorageProvider
fn clone(&self) -> TempStorageProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TempStorageProvider
impl Debug for TempStorageProvider
Source§impl Default for TempStorageProvider
impl Default for TempStorageProvider
Source§fn default() -> TempStorageProvider
fn default() -> TempStorageProvider
Returns the “default value” for a type. Read more
Source§impl StorageProvider for TempStorageProvider
impl StorageProvider for TempStorageProvider
Source§type Reader = TempStorageReader
type Reader = TempStorageReader
Source used to read from the underlying storage.
Source§fn into_reader_writer(
self,
_content_length: Option<u64>,
) -> Result<(Self::Reader, Self::Writer)>
fn into_reader_writer( self, _content_length: Option<u64>, ) -> Result<(Self::Reader, Self::Writer)>
Turn the provider into a reader and writer.
Source§fn max_capacity(&self) -> Option<usize>
fn max_capacity(&self) -> Option<usize>
Returns the maximum number of bytes this provider can hold at a time.
Auto Trait Implementations§
impl Freeze for TempStorageProvider
impl !RefUnwindSafe for TempStorageProvider
impl Send for TempStorageProvider
impl Sync for TempStorageProvider
impl Unpin for TempStorageProvider
impl !UnwindSafe for TempStorageProvider
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