pub struct Novel { /* private fields */ }Expand description
Represents a novel. Stored on disk at the following path: <base_library_path>/<novel.title()>/
TODO: Detect remote novel title changes
Implementations§
Source§impl Novel
impl Novel
Sourcepub fn new(
url: impl Into<Url>,
library_path: &Path,
) -> Result<Self, LibraryError>
pub fn new( url: impl Into<Url>, library_path: &Path, ) -> Result<Self, LibraryError>
Returns a new Novel from the given URL. Functionally equivalent to
[Novel::try_from(Url)].
Sourcepub fn title(&self) -> Result<String, LibraryError>
pub fn title(&self) -> Result<String, LibraryError>
Returns the title of the novel
Sourcepub fn get_chapter_storage_path(novel_path: &Path) -> PathBuf
pub fn get_chapter_storage_path(novel_path: &Path) -> PathBuf
returns where all the chapters are stored. static alternative to
[self.chapter_storage_path()].
Sourcepub fn get_cover_storage_path(novel_path: &Path) -> PathBuf
pub fn get_cover_storage_path(novel_path: &Path) -> PathBuf
returns where the cover image is stored. static alternative to
[self.cover_storage_path].
Sourcepub fn chapter_storage_path(&self) -> PathBuf
pub fn chapter_storage_path(&self) -> PathBuf
Returns where all the chapters are stored. Alternative to the static
Self::get_chapter_storage_path.
Sourcepub fn cover_storage_path(&self) -> PathBuf
pub fn cover_storage_path(&self) -> PathBuf
Returns where the cover image is stored. Alternative to the static
Self::get_cover_storage_path.
Sourcepub fn download_cover(&self) -> Result<(), LibraryError>
pub fn download_cover(&self) -> Result<(), LibraryError>
Downloads the cover file and places it in [self.cover_image_path],
performing appropriate image format conversions if necessary.
Sourcepub fn update(&mut self) -> Result<(), LibraryError>
pub fn update(&mut self) -> Result<(), LibraryError>
Fetch remote chapters & saves them locally. Will attempt to fix duplicates, ordering, and detect collisions.
Sourcepub fn consolidate_chapter_collection(&mut self)
pub fn consolidate_chapter_collection(&mut self)
Sorts, dedups and tries to fix chapter indexes in the current “live” chapter list.
Sourcepub fn update_iter(&mut self) -> NovelChapterUpdateIter<'_> ⓘ
pub fn update_iter(&mut self) -> NovelChapterUpdateIter<'_> ⓘ
Returns an iterator that will fetch the chapters, returning a Result for
each operation. See NovelChapterUpdateIter::next for more info.
Will not attempt to handle duplicates & other stuff.
§Panics
Panics when:
- [
self.get_missing_chapters_indexes] panics
Sourcepub fn get_missing_chapters_indexes(&self) -> Result<Vec<usize>, LibraryError>
pub fn get_missing_chapters_indexes(&self) -> Result<Vec<usize>, LibraryError>
Returns chapter indexes that are present in the source but not locally.
Sourcepub fn get_local_chapter_count(&self) -> Result<usize, LibraryError>
pub fn get_local_chapter_count(&self) -> Result<usize, LibraryError>
Returns the count of locally-saved chapters
Sourcepub fn get_remote_chapter_count(&self) -> Result<usize, LibraryError>
pub fn get_remote_chapter_count(&self) -> Result<usize, LibraryError>
returns the total count of remote chapters
Sourcepub fn load_local_chapters(&mut self) -> Result<(), LibraryError>
pub fn load_local_chapters(&mut self) -> Result<(), LibraryError>
Loads local chapters and saves them in self.chapters. Overrides any
currently loaded chapters.
Sourcepub fn get_local_chapters(&self) -> Result<Vec<Chapter>, LibraryError>
pub fn get_local_chapters(&self) -> Result<Vec<Chapter>, LibraryError>
Returns a vector of all local Chapter.
Sourcepub fn novel_path(&self) -> &Path
pub fn novel_path(&self) -> &Path
Returns the root path of where this novel stores its files.
Sourcepub fn generate_epub(&self) -> Result<PathBuf, EpubGenerationError>
pub fn generate_epub(&self) -> Result<PathBuf, EpubGenerationError>
Generates an epub from this novel and its currently loaded chapters, returning the path it has been saved to.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Novel
impl<'de> Deserialize<'de> for Novel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Novel
impl !RefUnwindSafe for Novel
impl !Send for Novel
impl !Sync for Novel
impl Unpin for Novel
impl UnwindSafe for Novel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more