pub struct UploadedFile { /* private fields */ }Expand description
One uploaded file from a multipart/form-data part.
Implementations§
Source§impl UploadedFile
impl UploadedFile
Sourcepub const fn from_bytes(
filename: Option<String>,
content_type: Option<String>,
bytes: Vec<u8>,
) -> UploadedFile
pub const fn from_bytes( filename: Option<String>, content_type: Option<String>, bytes: Vec<u8>, ) -> UploadedFile
Builds an in-memory upload (tests and Memory storage).
Sourcepub fn from_tempfile(
filename: Option<String>,
content_type: Option<String>,
bytes: &[u8],
) -> Result<UploadedFile, FormError>
pub fn from_tempfile( filename: Option<String>, content_type: Option<String>, bytes: &[u8], ) -> Result<UploadedFile, FormError>
Builds a tempfile-backed upload.
§Errors
Returns FormError::Upload when the tempfile cannot be created or written.
Sourcepub fn content_type(&self) -> Option<&str>
pub fn content_type(&self) -> Option<&str>
Client-supplied Content-Type when present.
Sourcepub const fn as_bytes(&self) -> Option<&[u8]>
pub const fn as_bytes(&self) -> Option<&[u8]>
In-memory bytes when storage is FileStorage::Memory.
Sourcepub fn path(&self) -> Option<&Path>
pub fn path(&self) -> Option<&Path>
Filesystem path when storage is FileStorage::TempFile.
Sourcepub fn into_bytes(self) -> Result<Vec<u8>, FormError>
pub fn into_bytes(self) -> Result<Vec<u8>, FormError>
Consumes the upload and returns the raw bytes.
§Errors
Returns FormError::Upload when a tempfile cannot be read.
Trait Implementations§
Auto Trait Implementations§
impl Forget for UploadedFile
impl Freeze for UploadedFile
impl Move for UploadedFile
impl RefUnwindSafe for UploadedFile
impl Send for UploadedFile
impl Sync for UploadedFile
impl Unpin for UploadedFile
impl UnsafeUnpin for UploadedFile
impl UnwindSafe for UploadedFile
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.