Struct mobi::headers::MobiMetadata
source · pub struct MobiMetadata {
pub name: Vec<u8>,
pub header: Header,
pub records: PdbRecords,
pub palmdoc: PalmDocHeader,
pub mobi: MobiHeader,
pub exth: ExtHeader,
}
Expand description
Holds all headers containing low level metadata of a mobi book
Fields§
§name: Vec<u8>
§header: Header
§records: PdbRecords
§palmdoc: PalmDocHeader
§mobi: MobiHeader
§exth: ExtHeader
Implementations§
source§impl MobiMetadata
impl MobiMetadata
sourcepub fn new<B: AsRef<Vec<u8>>>(
bytes: B
) -> Result<MobiMetadata, MetadataParseError>
pub fn new<B: AsRef<Vec<u8>>>(
bytes: B
) -> Result<MobiMetadata, MetadataParseError>
Construct a Metadata object from a slice of bytes
sourcepub fn from_path<P: AsRef<Path>>(
file_path: P
) -> Result<MobiMetadata, MetadataParseError>
pub fn from_path<P: AsRef<Path>>(
file_path: P
) -> Result<MobiMetadata, MetadataParseError>
Construct a Metadata object from passed file path
sourcepub fn from_read<R: Read>(reader: R) -> Result<MobiMetadata, MetadataParseError>
pub fn from_read<R: Read>(reader: R) -> Result<MobiMetadata, MetadataParseError>
Construct a Metadata object from an object that implements a Read trait
sourcepub fn exth_record(&self, record: ExthRecord) -> Option<&Vec<Vec<u8>>>
pub fn exth_record(&self, record: ExthRecord) -> Option<&Vec<Vec<u8>>>
Returns raw ExthRecord data located at appropriate position if it exists. It is highly recommended to use public api provided here to access those records but in case where lower level access is needed this method provides access to all fields.
Some records can occur multiple times thats why a list of data buffers is returned.
sourcepub fn exth_record_at(&self, position: u32) -> Option<&Vec<Vec<u8>>>
pub fn exth_record_at(&self, position: u32) -> Option<&Vec<Vec<u8>>>
Returns raw ExthRecord data located at passed position if it exists.
If unsure where the wanted record is located at use exth_record method that limits possible position to those commonly available on mobi books.
It is highly recommended to instead use public api provided here to access those records but in case where lower level access is needed this method provides access to all fields.
Some records can occur multiple times thats why a list of data buffers is returned.
Returns an author of this book
sourcepub fn description(&self) -> Option<String>
pub fn description(&self) -> Option<String>
Returns description record if such exists
sourcepub fn publish_date(&self) -> Option<String>
pub fn publish_date(&self) -> Option<String>
Returns publish_date record if such exists
sourcepub fn contributor(&self) -> Option<String>
pub fn contributor(&self) -> Option<String>
Returns contributor record if such exists
sourcepub fn title(&self) -> String
pub fn title(&self) -> String
Returns title record read from EXTH header if it exists or defaults to full book name read from location specified in MOBI header.
sourcepub fn text_encoding(&self) -> TextEncoding
pub fn text_encoding(&self) -> TextEncoding
Returns text encoding used in ebook
sourcepub fn created_datetime(&self) -> NaiveDateTime
pub fn created_datetime(&self) -> NaiveDateTime
Returns creation datetime
This field is only available using time
feature
sourcepub fn mod_datetime(&self) -> NaiveDateTime
pub fn mod_datetime(&self) -> NaiveDateTime
Returns modification datetime
This field is only available using time
feature
sourcepub fn compression(&self) -> Compression
pub fn compression(&self) -> Compression
Returns compression method used on this file
sourcepub fn encryption(&self) -> Encryption
pub fn encryption(&self) -> Encryption
Returns encryption method used on this file