Skip to main content

Container

Struct Container 

Source
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

Source

pub fn open(path: &Path) -> Result<Container>

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Container, String>

Source

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.

Source

pub fn read_optional(&mut self, name: &str) -> Option<String>

Read an entry, or None when it does not exist.

Source

pub fn names(&self) -> Vec<String>

Every entry name, in the archive’s own order.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.