[][src]Struct zim::Zim

pub struct Zim {
    pub header: ZimHeader,
    pub master_view: Mmap,
    pub file_path: PathBuf,
    pub mime_table: Vec<String>,
    pub url_list: Vec<u64>,
    pub article_list: Vec<u32>,
    pub cluster_list: Vec<u64>,
    pub checksum: GenericArray<u8, <Md5 as Digest>::OutputSize>,
}

Represents a ZIM file

Fields

header: ZimHeadermaster_view: Mmapfile_path: PathBuf

The path to the file.

mime_table: Vec<String>

List of mimetypes used in this ZIM archive

url_list: Vec<u64>article_list: Vec<u32>cluster_list: Vec<u64>checksum: GenericArray<u8, <Md5 as Digest>::OutputSize>

MD5 checksum.

Methods

impl Zim[src]

pub fn new<P: AsRef<Path>>(p: P) -> Result<Zim, Error>[src]

Loads a Zim file

Loads a Zim file and parses the header, and the url, title, and cluster offset tables. The rest of the data isn't parsed until it's needed, so this should be fairly quick.

pub fn article_count(&self) -> usize[src]

Get the number of articles.

pub fn verify_checksum(&self) -> Result<(), Error>[src]

Computes the checksum, and returns an error if it does not match the one in the file.

pub fn get_mimetype(&self, id: u16) -> Option<MimeType>[src]

Indexes into the ZIM mime_table.

pub fn iterate_by_urls(&self) -> DirectoryIterator[src]

Iterates over articles, sorted by URL.

For performance reasons, you might want to extract by cluster instead.

pub fn get_by_url_index(&self, idx: u32) -> Result<DirectoryEntry, Error>[src]

Returns the DirectoryEntry for the article found at the given URL index.

idx must be between 0 and article_count

pub fn get_cluster(&self, idx: u32) -> Result<Cluster, Error>[src]

Returns the given Cluster

idx must be between 0 and cluster_count

Auto Trait Implementations

impl RefUnwindSafe for Zim

impl Send for Zim

impl Sync for Zim

impl Unpin for Zim

impl UnwindSafe for Zim

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.