pub struct Container { /* private fields */ }Expand description
A ZIP archive read fully into memory.
Office documents are small relative to the machines that read them, and the
extractors jump between entries (document.xml, then its relationships,
then the numbering table), so streaming would buy nothing.
Implementations§
Source§impl Container
impl Container
pub fn open(path: &Path) -> Result<Container>
pub fn from_bytes(bytes: &[u8]) -> Result<Container, String>
Sourcepub fn read(&mut self, name: &str) -> Result<String, String>
pub fn read(&mut self, name: &str) -> Result<String, String>
Read an entry as text. Entries are UTF-8 in every format we support; anything else is decoded lossily rather than failing the document.
Sourcepub fn read_optional(&mut self, name: &str) -> Option<String>
pub fn read_optional(&mut self, name: &str) -> Option<String>
Read an entry, or None when it does not exist.
Sourcepub fn names_under(&self, prefix: &str) -> Vec<String>
pub fn names_under(&self, prefix: &str) -> Vec<String>
Entry names under a prefix, sorted so numbered parts line up naturally
(slide2.xml before slide10.xml).
Auto Trait Implementations§
impl Forget for Container
impl Freeze for Containerwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<ZipArchiveMetadata> is !null: Freeze,
PhantomData<ArcInner<ZipArchiveMetadata>>: Freeze,
impl Move for Container
impl RefUnwindSafe for Container
impl Send for Container
impl Sync for Container
impl Unpin for Container
impl UnsafeUnpin for Containerwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<ZipArchiveMetadata> is !null: UnsafeUnpin,
PhantomData<ArcInner<ZipArchiveMetadata>>: UnsafeUnpin,
impl UnwindSafe for Container
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