#[non_exhaustive]pub enum Format {
Html,
Pdf,
Docx,
Doc,
Xlsx,
Xls,
Ods,
Pptx,
Csv,
PlainText,
Markdown,
Unknown,
}Expand description
Detected document format.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Html
Docx
Office Open XML word processing (.docx, .docm, .dotx).
Doc
Legacy Word 97-2003 binary (.doc). Detected but not supported.
Xlsx
Office Open XML spreadsheet (.xlsx, .xlsm, .xltx).
Xls
Legacy Excel 97-2003 binary (.xls).
Ods
OpenDocument spreadsheet (.ods).
Pptx
Office Open XML presentation (.pptx). Detected but not supported.
Csv
PlainText
Markdown
Unknown
Implementations§
Source§impl Format
impl Format
Sourcepub fn from_content_type(content_type: &str) -> Self
pub fn from_content_type(content_type: &str) -> Self
Detect format from a MIME content type string.
Sourcepub fn from_extension(ext: &str) -> Self
pub fn from_extension(ext: &str) -> Self
Detect format from a file extension (without the dot).
Sourcepub fn from_file_name(name: &str) -> Self
pub fn from_file_name(name: &str) -> Self
Detect format from a file name or URL path (query/fragment ignored).
Sourcepub fn detect(bytes: &[u8], hint: DocumentHint<'_>) -> Self
pub fn detect(bytes: &[u8], hint: DocumentHint<'_>) -> Self
Detect format: content type, then file extension, then magic bytes.
Trait Implementations§
impl Copy for Format
Source§impl<'de> Deserialize<'de> for Format
impl<'de> Deserialize<'de> for Format
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Format
impl StructuralPartialEq for Format
Auto Trait Implementations§
impl Freeze for Format
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnsafeUnpin for Format
impl UnwindSafe for Format
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