Struct zim::Zim

source ·
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 OutputSizeUser>::OutputSize>,
}
Expand description

Represents a ZIM file

Fields§

§header: ZimHeader§master_view: Mmap§file_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 OutputSizeUser>::OutputSize>

MD5 checksum.

Implementations§

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.

Get the number of articles.

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

Indexes into the ZIM mime_table.

Iterates over articles, sorted by URL.

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

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

idx must be between 0 and article_count

Returns the given Cluster

idx must be between 0 and cluster_count

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.