pub struct Info {
pub extension: String,
pub content_type: String,
pub encoding: String,
}Expand description
MIME type information including extension, content type, and encoding.
This struct contains all the information about a specific MIME type, including whether it’s a binary or text format.
Fields§
§extension: StringFile extension (without the dot)
content_type: StringMIME content type (e.g., “text/plain”, “image/png”)
encoding: StringEncoding type (e.g., “8bit”, “base64”)
Implementations§
Source§impl Info
impl Info
Sourcepub fn new(line: &str) -> Option<Self>
pub fn new(line: &str) -> Option<Self>
Creates a new Info instance from a database line.
The line format is: extension content_type encoding
§Arguments
line- A whitespace-separated string containing extension, content type, and encoding
§Returns
Some(Info)if the line is validNoneif the line doesn’t have at least 3 parts
§Examples
use minimime::Info;
let info = Info::new("pdf application/pdf base64").unwrap();
assert_eq!(info.extension, "pdf");
assert_eq!(info.content_type, "application/pdf");
assert_eq!(info.encoding, "base64");Sourcepub fn is_binary(&self) -> bool
pub fn is_binary(&self) -> bool
Determines if this MIME type represents a binary file format.
Binary files are those that use “base64” or “8bit” encoding.
§Returns
trueif the file type is binaryfalseif the file type is text-based
§Examples
use minimime::Info;
let pdf = Info::new("pdf application/pdf base64").unwrap();
assert!(pdf.is_binary());
let txt = Info::new("txt text/plain 7bit").unwrap();
assert!(!txt.is_binary());Trait Implementations§
impl StructuralPartialEq for Info
Auto Trait Implementations§
impl Freeze for Info
impl RefUnwindSafe for Info
impl Send for Info
impl Sync for Info
impl Unpin for Info
impl UnwindSafe for Info
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