Skip to main content

asic_e/
lib.rs

1//! ASiC-E container format.
2
3use thiserror::Error;
4
5mod container;
6mod manifest;
7
8pub use container::{Container, DataFile, OpenOptions, SignatureFile};
9
10/// ASiC-E container media type.
11pub const MIMETYPE: &str = "application/vnd.etsi.asic-e+zip";
12
13/// OpenDocument manifest namespace (META-INF/manifest.xml).
14pub(crate) const MANIFEST_NS: &str = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0";
15
16/// Errors produced while reading or writing containers.
17#[derive(Error, Debug)]
18pub enum LibError {
19    /// Structural problem.
20    #[error("container: {0}")]
21    Container(String),
22
23    /// Underlying zip archive error.
24    #[error("zip: {0}")]
25    Zip(#[from] zip::result::ZipError),
26
27    /// I/O error while reading or writing.
28    #[error("io: {0}")]
29    Io(#[from] std::io::Error),
30
31    /// Malformed XML entry.
32    #[error("xml: {0}")]
33    Xml(String),
34}
35
36pub type Result<T> = std::result::Result<T, LibError>;