Mobi

Struct Mobi 

Source
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

Source

pub fn new<B: AsRef<Vec<u8>>>(bytes: B) -> MobiResult<Mobi>

Construct a Mobi object from a slice of bytes

Source

pub fn from_path<P: AsRef<Path>>(file_path: P) -> MobiResult<Mobi>

Construct a Mobi object from passed file path

Source

pub fn from_read<R: Read>(reader: R) -> MobiResult<Mobi>

Construct a Mobi object from an object that implements a Read trait

Source

pub fn author(&self) -> Option<String>

Returns an author of this book

Source

pub fn publisher(&self) -> Option<String>

Returns this books publisher

Source

pub fn description(&self) -> Option<String>

Returns description record if such exists

Source

pub fn isbn(&self) -> Option<String>

Returns isbn record if such exists

Source

pub fn publish_date(&self) -> Option<String>

Returns publish_date record if such exists

Source

pub fn contributor(&self) -> Option<String>

Returns contributor record if such exists

Source

pub fn title(&self) -> String

Returns title record if such exists

Source

pub fn text_encoding(&self) -> TextEncoding

Returns text encoding used in ebook

Source

pub fn mobi_type(&self) -> MobiType

Returns type of this ebook

Source

pub fn language(&self) -> Language

Returns language of the ebook

Source

pub fn created_datetime(&self) -> NaiveDateTime

Returns creation datetime This field is only available using time feature

Source

pub fn mod_datetime(&self) -> NaiveDateTime

Returns modification datetime This field is only available using time feature

Source

pub fn compression(&self) -> Compression

Returns compression method used on this file

Source

pub fn encryption(&self) -> Encryption

Returns encryption method used on this file

Source

pub fn readable_records_range(&self) -> Range<usize>

Returns the readable reacord range - from first content record to first non book index.

Source

pub fn raw_records(&self) -> RawRecords<'_>

Returns raw records that contain compressed, encrypted and encoded content slices.

Source

pub fn image_records(&self) -> Vec<RawRecord<'_>>

Returns all records classified as image records.

Source

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

Source

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.

Trait Implementations§

Source§

impl Debug for Mobi

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Mobi

Source§

fn default() -> Mobi

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Mobi

§

impl RefUnwindSafe for Mobi

§

impl Send for Mobi

§

impl Sync for Mobi

§

impl Unpin for Mobi

§

impl UnwindSafe for Mobi

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.