Skip to main content

brepkit_io/
lib.rs

1//! # brepkit-io
2//!
3//! Data exchange for brepkit: STEP, IGES, 3MF, STL, OBJ, PLY, and glTF import/export.
4//!
5//! This is layer L3, depending on `brepkit-math`, `brepkit-topology`,
6//! and `brepkit-operations`.
7
8pub mod arena_io;
9pub mod gltf;
10pub mod iges;
11pub mod obj;
12pub mod ply;
13pub mod step;
14pub mod stl;
15pub mod threemf;
16
17/// Errors from data exchange operations.
18#[derive(Debug, thiserror::Error)]
19pub enum IoError {
20    /// The input file format is invalid or malformed.
21    #[error("parse error: {reason}")]
22    ParseError {
23        /// Description of the parse failure.
24        reason: String,
25    },
26
27    /// An unsupported STEP entity was encountered.
28    #[error("unsupported STEP entity: {entity}")]
29    UnsupportedEntity {
30        /// The entity type name.
31        entity: String,
32    },
33
34    /// The topology is incomplete or inconsistent for export.
35    #[error("invalid topology for export: {reason}")]
36    InvalidTopology {
37        /// Description of the topology issue.
38        reason: String,
39    },
40
41    /// A topology lookup failed.
42    #[error(transparent)]
43    Topology(#[from] brepkit_topology::TopologyError),
44
45    /// An I/O error occurred.
46    #[error(transparent)]
47    Io(#[from] std::io::Error),
48
49    /// An error from a modeling operation (e.g. tessellation).
50    #[error(transparent)]
51    Operations(#[from] brepkit_operations::OperationsError),
52
53    /// An error writing the ZIP archive.
54    #[error(transparent)]
55    Zip(#[from] zip::result::ZipError),
56}