pub struct EpubDocument<R: Read + Seek> {
archive: ZipArchive<R>,
info: XmlTree,
parent: PathBuf,
engine: Engine,
spine: Vec<Chunk>,
cache: FxHashMap<usize, Vec<Page>>,
ignore_document_css: bool,
}Expand description
Generic EPUB document that works with any Read + Seek source.
Fields§
§archive: ZipArchive<R>§info: XmlTree§parent: PathBuf§engine: Engine§spine: Vec<Chunk>§cache: FxHashMap<usize, Vec<Page>>§ignore_document_css: boolImplementations§
Source§impl<R: Read + Seek> EpubDocument<R>
impl<R: Read + Seek> EpubDocument<R>
fn from_archive(archive: ZipArchive<R>) -> Result<Self, Error>
fn offset(&self, index: usize) -> usize
fn size(&self) -> usize
fn vertebra_coordinates_with<F>(&self, test: F) -> Option<(usize, usize)>
fn vertebra_coordinates(&self, offset: usize) -> Option<(usize, usize)>
fn vertebra_coordinates_from_name(&self, name: &str) -> Option<(usize, usize)>
fn walk_toc_ncx( &mut self, node: NodeRef<'_>, toc_dir: &Path, index: &mut usize, cache: &mut FxHashMap<String, usize>, ) -> Vec<TocEntry>
fn page_index( &mut self, offset: usize, index: usize, start_offset: usize, ) -> Option<usize>
fn resolve_link( &mut self, uri: &str, cache: &mut FxHashMap<String, usize>, ) -> Option<usize>
fn cache_uris( &mut self, node: NodeRef<'_>, name: &str, start_offset: usize, cache: &mut FxHashMap<String, usize>, )
fn build_display_list(&mut self, index: usize, start_offset: usize) -> Vec<Page> ⓘ
pub fn categories(&self) -> BTreeSet<String>
fn chapter_aux<'a>( &mut self, toc: &'a [TocEntry], offset: usize, next_offset: usize, path: &str, end_offset: &mut usize, chap_before: &mut Option<&'a TocEntry>, offset_before: &mut usize, chap_after: &mut Option<&'a TocEntry>, offset_after: &mut usize, )
fn previous_chapter<'a>( &mut self, chap: Option<&TocEntry>, start_offset: usize, end_offset: usize, toc: &'a [TocEntry], ) -> Option<&'a TocEntry>
fn next_chapter<'a>( &mut self, chap: Option<&TocEntry>, start_offset: usize, end_offset: usize, toc: &'a [TocEntry], ) -> Option<&'a TocEntry>
pub fn series(&self) -> Option<(String, String)>
pub fn cover_image(&self) -> Option<&str>
pub fn description(&self) -> Option<String>
pub fn publisher(&self) -> Option<String>
pub fn language(&self) -> Option<String>
pub fn year(&self) -> Option<String>
Source§impl EpubDocument<Cursor<&'static [u8]>>
impl EpubDocument<Cursor<&'static [u8]>>
pub fn new_from_static(bytes: &'static [u8]) -> Result<Self, Error>
Trait Implementations§
Source§impl<R: Read + Seek> Document for EpubDocument<R>
impl<R: Read + Seek> Document for EpubDocument<R>
fn preview_pixmap( &mut self, width: f32, height: f32, samples: usize, ) -> Option<Pixmap>
fn dims(&self, _index: usize) -> Option<(f32, f32)>
fn pages_count(&self) -> usize
fn toc(&mut self) -> Option<Vec<TocEntry>>
fn chapter<'a>( &mut self, offset: usize, toc: &'a [TocEntry], ) -> Option<(&'a TocEntry, f32)>
fn chapter_relative<'a>( &mut self, offset: usize, dir: CycleDir, toc: &'a [TocEntry], ) -> Option<&'a TocEntry>
fn resolve_location(&mut self, loc: Location) -> Option<usize>
fn words(&mut self, loc: Location) -> Option<(Vec<BoundedText>, usize)>
fn lines(&mut self, _loc: Location) -> Option<(Vec<BoundedText>, usize)>
fn links(&mut self, loc: Location) -> Option<(Vec<BoundedText>, usize)>
fn images(&mut self, loc: Location) -> Option<(Vec<Boundary>, usize)>
fn pixmap( &mut self, loc: Location, scale: f32, samples: usize, ) -> Option<(Pixmap, usize)>
fn layout(&mut self, width: u32, height: u32, font_size: f32, dpi: u16)
fn set_text_align(&mut self, text_align: TextAlign)
fn set_font_family(&mut self, family_name: &str, search_path: &str)
fn set_margin_width(&mut self, width: i32)
fn set_line_height(&mut self, line_height: f32)
fn set_hyphen_penalty(&mut self, hyphen_penalty: i32)
fn set_stretch_tolerance(&mut self, stretch_tolerance: f32)
fn set_ignore_document_css(&mut self, ignore: bool)
fn title(&self) -> Option<String>
fn metadata(&self, key: &str) -> Option<String>
fn is_reflowable(&self) -> bool
fn has_synthetic_page_numbers(&self) -> bool
fn save(&self, _path: &str) -> Result<(), Error>
impl<R: Read + Seek> Send for EpubDocument<R>
impl<R: Read + Seek> Sync for EpubDocument<R>
Auto Trait Implementations§
impl<R> Freeze for EpubDocument<R>where
R: Freeze,
impl<R> RefUnwindSafe for EpubDocument<R>where
R: RefUnwindSafe,
impl<R> Unpin for EpubDocument<R>where
R: Unpin,
impl<R> UnwindSafe for EpubDocument<R>where
R: UnwindSafe,
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.