pub struct Mobi {
pub content: Vec<u8>,
pub metadata: MobiMetadata,
}
Expand description
Structure that holds parsed ebook information and contents
Fields§
§content: Vec<u8>
§metadata: MobiMetadata
Implementations§
source§impl Mobi
impl Mobi
sourcepub fn new<B: AsRef<Vec<u8>>>(bytes: B) -> MobiResult<Mobi>
pub fn new<B: AsRef<Vec<u8>>>(bytes: B) -> MobiResult<Mobi>
Construct a Mobi object from a slice of bytes
sourcepub fn from_path<P: AsRef<Path>>(file_path: P) -> MobiResult<Mobi>
pub fn from_path<P: AsRef<Path>>(file_path: P) -> MobiResult<Mobi>
Construct a Mobi object from passed file path
sourcepub fn from_read<R: Read>(reader: R) -> MobiResult<Mobi>
pub fn from_read<R: Read>(reader: R) -> MobiResult<Mobi>
Construct a Mobi object from an object that implements a Read trait
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 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
sourcepub fn readable_records_range(&self) -> Range<usize>
pub fn readable_records_range(&self) -> Range<usize>
Returns the readable reacord range - from first content record to first non book index.
sourcepub fn raw_records(&self) -> RawRecords<'_>
pub fn raw_records(&self) -> RawRecords<'_>
Returns raw records that contain compressed, encrypted and encoded content slices.
sourcepub fn image_records(&self) -> Vec<RawRecord<'_>>
pub fn image_records(&self) -> Vec<RawRecord<'_>>
Returns all records classified as image records.
sourcepub fn content_as_string_lossy(&self) -> String
pub fn content_as_string_lossy(&self) -> String
Returns all readable records content decompressed as a String. There are only two supported encodings in mobi format (UTF8, WIN1252) and both are losely converted by this function
sourcepub fn content_as_string(&self) -> MobiResult<String>
pub fn content_as_string(&self) -> MobiResult<String>
Returns all readable records content decompressed as a String. This function is a strict version returning error on first encountered decoding error.