pub struct FileInfo {
pub filename: Option<String>,
pub safe_filename: Option<String>,
pub extension: Option<String>,
pub declared_type: Option<String>,
pub detected: Detection,
pub text_subtype_ok: bool,
pub size: u64,
pub cap: u64,
pub width: Option<u32>,
pub height: Option<u32>,
pub utf8: Option<bool>,
}Expand description
What the spooler learned about an upload.
Fields§
§filename: Option<String>The client’s file name, raw.
safe_filename: Option<String>The name reduced to one safe path segment.
extension: Option<String>The lowercase last suffix of the safe name, without the dot.
declared_type: Option<String>The Content-Type the client declared for the part.
detected: DetectionWhat the first bytes said.
text_subtype_ok: boolWhether the declared text subtype’s structure was present.
size: u64Bytes received.
cap: u64The most bytes the spool stores: the rule’s max_bytes capped by
[limits] max_file_bytes. A larger size is a file cut short.
width: Option<u32>Image dimensions when the header carried them.
height: Option<u32>See width.
utf8: Option<bool>Whether every byte was valid UTF-8 (None when not checked).
Implementations§
Source§impl FileInfo
impl FileInfo
Sourcepub fn effective_type(&self) -> &str
pub fn effective_type(&self) -> &str
The media type this file is treated as: the detected type when
there is one; for text, the declared subtype when it is a text type
whose structure matched, else text/plain; otherwise the declared
header only when nothing in the table would have detected it.
Sourcepub fn is_executable(&self) -> bool
pub fn is_executable(&self) -> bool
Whether the file is an executable by bytes or by extension.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileInfo
impl RefUnwindSafe for FileInfo
impl Send for FileInfo
impl Sync for FileInfo
impl Unpin for FileInfo
impl UnsafeUnpin for FileInfo
impl UnwindSafe for FileInfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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