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: MobiMetadataImplementations§
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.