1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/// All errors that can be returned by cloudini operations.
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// The input is shorter than the minimum Cloudini header size.
#[error("input too small to contain a Cloudini header")]
TooSmall,
/// The magic bytes at the start of the buffer do not match `CLOUDINI_V`.
#[error("invalid magic header (got {got:?})")]
InvalidMagic { got: String },
/// The version number in the header is not supported by this build.
#[error("unsupported encoding version {got} (current: {current})")]
UnsupportedVersion { got: u8, current: u8 },
/// The YAML or binary header is structurally invalid.
#[error("malformed header: {0}")]
MalformedHeader(String),
/// `point_step` in [`crate::EncodingInfo`] is zero.
#[error("point_step cannot be 0")]
ZeroPointStep,
/// The raw cloud data length is not a multiple of `point_step`.
#[error("cloud data length is not a multiple of point_step")]
DataLengthMismatch,
/// Compressed data is truncated, corrupt, or internally inconsistent.
#[error("truncated or corrupt data: {0}")]
Truncated(String),
/// LZ4 compression or decompression failed.
#[error("LZ4 error: {0}")]
Lz4(String),
/// ZSTD compression or decompression failed.
#[error("ZSTD error: {0}")]
Zstd(String),
/// The C++ binding returned an error (feature `use_cpp`).
#[cfg(feature = "use_cpp")]
#[error("C++ binding error: {0}")]
Cpp(String),
}
/// Convenience alias so callers can write `cloudini::Result<T>`.
pub type Result<T> = std::result::Result<T, Error>;