pub struct EpubArchive<R: Read + Seek> {
pub path: PathBuf,
pub files: Vec<String>,
/* private fields */
}
Expand description
Epub archive struct. Here it’s stored the file path and the list of files in the zip archive.
Fields§
§path: PathBuf
§files: Vec<String>
Implementations§
Source§impl EpubArchive<BufReader<File>>
impl EpubArchive<BufReader<File>>
Source§impl<R: Read + Seek> EpubArchive<R>
impl<R: Read + Seek> EpubArchive<R>
Sourcepub fn from_reader(reader: R) -> Result<Self, ArchiveError>
pub fn from_reader(reader: R) -> Result<Self, ArchiveError>
Sourcepub fn get_entry<P: AsRef<Path>>(
&mut self,
name: P,
) -> Result<Vec<u8>, ArchiveError>
pub fn get_entry<P: AsRef<Path>>( &mut self, name: P, ) -> Result<Vec<u8>, ArchiveError>
Returns the content of the file by the name
as Vec<u8>
.
§Errors
Returns an error if the name doesn’t exists in the zip archive.
Sourcepub fn get_entry_as_str<P: AsRef<Path>>(
&mut self,
name: P,
) -> Result<String, ArchiveError>
pub fn get_entry_as_str<P: AsRef<Path>>( &mut self, name: P, ) -> Result<String, ArchiveError>
Returns the content of the file by the name
as String
.
§Errors
Returns an error if the name doesn’t exists in the zip archive.
Sourcepub fn get_container_file(&mut self) -> Result<Vec<u8>, ArchiveError>
pub fn get_container_file(&mut self) -> Result<Vec<u8>, ArchiveError>
Returns the content of container file “META-INF/container.xml”.
§Errors
Returns an error if the epub doesn’t have the container file.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for EpubArchive<R>where
R: Freeze,
impl<R> RefUnwindSafe for EpubArchive<R>where
R: RefUnwindSafe,
impl<R> Send for EpubArchive<R>where
R: Send,
impl<R> Sync for EpubArchive<R>where
R: Sync,
impl<R> Unpin for EpubArchive<R>where
R: Unpin,
impl<R> UnwindSafe for EpubArchive<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