pub struct ReadingSession { /* private fields */ }Expand description
Lightweight mutable reading session detached from ZIP/file state.
Implementations§
Source§impl ReadingSession
impl ReadingSession
Sourcepub fn new(chapters: Vec<ChapterRef>, navigation: Option<Navigation>) -> Self
pub fn new(chapters: Vec<ChapterRef>, navigation: Option<Navigation>) -> Self
Create a reading session from chapter descriptors and optional navigation.
Sourcepub fn current_position(&self) -> ReadingPosition
pub fn current_position(&self) -> ReadingPosition
Return current stable reading position.
Sourcepub fn seek_position(&mut self, pos: &ReadingPosition) -> Result<(), EpubError>
pub fn seek_position(&mut self, pos: &ReadingPosition) -> Result<(), EpubError>
Seek to an explicit reading position.
Sourcepub fn chapter_progress(&self) -> f32
pub fn chapter_progress(&self) -> f32
Chapter-local progress ratio in [0.0, 1.0].
Sourcepub fn book_progress(&self) -> f32
pub fn book_progress(&self) -> f32
Whole-book progress ratio in [0.0, 1.0].
Sourcepub fn resolve_locator(
&mut self,
loc: Locator,
) -> Result<ResolvedLocation, EpubError>
pub fn resolve_locator( &mut self, loc: Locator, ) -> Result<ResolvedLocation, EpubError>
Resolve a semantic locator to a concrete chapter/fragment location.
Trait Implementations§
Source§impl Clone for ReadingSession
impl Clone for ReadingSession
Source§fn clone(&self) -> ReadingSession
fn clone(&self) -> ReadingSession
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReadingSession
impl Debug for ReadingSession
Source§impl PartialEq for ReadingSession
impl PartialEq for ReadingSession
impl Eq for ReadingSession
impl StructuralPartialEq for ReadingSession
Auto Trait Implementations§
impl Freeze for ReadingSession
impl RefUnwindSafe for ReadingSession
impl Send for ReadingSession
impl Sync for ReadingSession
impl Unpin for ReadingSession
impl UnsafeUnpin for ReadingSession
impl UnwindSafe for ReadingSession
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