Skip to main content

affine_importer/
lib.rs

1mod batch;
2mod planner;
3mod provider;
4mod session;
5mod source;
6mod vfs;
7
8pub use batch::{
9  FolderHierarchyDelta, ImportBatch, ImportProgress, ImportWarning, ImportedAsset, ImportedDocMeta,
10  ImportedDocSnapshot, ImportedIcon, ImportedIconData, ImportedTag,
11};
12pub use planner::{ImportBatchLimits, ImportOptions};
13pub use provider::{ImportCursor, ImportProvider, ImportRegistry, ImportSource};
14pub use session::{ImportSession, ImportSessionOptions, ImportSessionState};
15#[cfg(test)]
16pub use source::ZipBytesSource;
17pub use source::{ArchiveEntryMeta, ArchiveSource, DirectoryPathSource, ZipPathSource};
18
19#[derive(Debug, thiserror::Error)]
20pub enum ImportError {
21  #[error("import was cancelled")]
22  Cancelled,
23  #[error("unsupported import format: {0}")]
24  UnsupportedFormat(String),
25  #[error("invalid source: {0}")]
26  InvalidSource(String),
27  #[error("zip error: {0}")]
28  Zip(#[from] zip::result::ZipError),
29  #[error("io error: {0}")]
30  Io(#[from] std::io::Error),
31  #[error("document build failed: {0}")]
32  Document(#[from] affine_doc_loader::ParseError),
33}
34
35pub type ImportResult<T> = Result<T, ImportError>;