pub struct StreamingMultipartField<'a> { /* private fields */ }Expand description
Implementations§
Source§impl<'a> StreamingMultipartField<'a>
impl<'a> StreamingMultipartField<'a>
Sourcepub fn file_name(&self) -> Option<&str>
pub fn file_name(&self) -> Option<&str>
Get the original filename when this field is a file upload.
Sourcepub fn content_type(&self) -> Option<&str>
pub fn content_type(&self) -> Option<&str>
Get the content type of the field.
Sourcepub fn bytes_read(&self) -> usize
pub fn bytes_read(&self) -> usize
Number of bytes consumed from this field so far.
Sourcepub async fn chunk(&mut self) -> Result<Option<Bytes>>
pub async fn chunk(&mut self) -> Result<Option<Bytes>>
Read the next chunk from the field stream.
Sourcepub async fn save_to(
&mut self,
dir: impl AsRef<Path>,
filename: Option<&str>,
) -> Result<String>
pub async fn save_to( &mut self, dir: impl AsRef<Path>, filename: Option<&str>, ) -> Result<String>
Save the field to a directory using either the provided filename or the uploaded name.
Sourcepub async fn save_as(&mut self, path: impl AsRef<Path>) -> Result<()>
pub async fn save_as(&mut self, path: impl AsRef<Path>) -> Result<()>
Save the field contents to an explicit file path without buffering the full file in memory.
Sourcepub async fn into_uploaded_file(self) -> Result<UploadedFile>
pub async fn into_uploaded_file(self) -> Result<UploadedFile>
Collect the field into an UploadedFile for APIs that still expect the buffered wrapper.
Auto Trait Implementations§
impl<'a> Freeze for StreamingMultipartField<'a>
impl<'a> !RefUnwindSafe for StreamingMultipartField<'a>
impl<'a> Send for StreamingMultipartField<'a>
impl<'a> Sync for StreamingMultipartField<'a>
impl<'a> Unpin for StreamingMultipartField<'a>
impl<'a> UnsafeUnpin for StreamingMultipartField<'a>
impl<'a> !UnwindSafe for StreamingMultipartField<'a>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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