rust_motion_affinity/
lib.rs1#![forbid(unsafe_code)]
9#![cfg_attr(
10 not(test),
11 deny(
12 clippy::unwrap_used,
13 clippy::expect_used,
14 clippy::panic,
15 clippy::unimplemented,
16 clippy::todo,
17 clippy::unreachable
18 )
19)]
20
21use std::fmt;
22
23mod access;
24pub mod container;
25mod geometry;
26pub mod model;
27pub mod paint;
28pub mod preview;
29mod raster;
30mod shapes;
31pub mod stream;
32#[cfg(any(test, feature = "synth"))]
33pub mod synth;
34mod text;
35
36pub use container::{is_affinity, Archive, Limits, MAGIC};
37pub use model::{read, Document};
38pub use preview::{preview, Preview, MAX_PREVIEW_BYTES, MAX_PREVIEW_DIMENSION};
39
40#[derive(Debug, Clone, Copy, PartialEq, Eq)]
42pub enum Error {
43 Malformed(&'static str),
44 Unsupported(&'static str),
45 Limit(&'static str),
46}
47
48impl fmt::Display for Error {
49 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
50 match self {
51 Self::Malformed(s) => write!(f, "damaged Affinity file: {s}"),
52 Self::Unsupported(s) => write!(f, "unsupported Affinity file: {s}"),
53 Self::Limit(s) => write!(f, "Affinity file exceeds a safety limit: {s}"),
54 }
55 }
56}
57
58impl std::error::Error for Error {}
59
60#[cfg(test)]
61mod tests;