micronet_antenna/error.rs
1#[cfg(feature = "std")]
2use thiserror::Error;
3
4#[cfg(feature = "std")]
5#[derive(Debug, Error)]
6/// Error type used by the `micronet-antenna` std wrapper.
7///
8/// The core crate (`micronet-antenna-core`) is transport-agnostic and does not
9/// define I/O errors. This error type exists to support std-only adapters such as
10/// UDP transport and serialization.
11pub enum Error {
12 #[error("serialization error: {0}")]
13 /// Serialization or deserialization failed.
14 Serialization(String),
15
16 #[error("io error: {0}")]
17 /// I/O failure from the underlying operating system.
18 Io(#[from] std::io::Error),
19}
20
21#[cfg(not(feature = "std"))]
22#[derive(Debug)]
23/// Minimal error type for non-std builds.
24///
25/// The `micronet-antenna` crate is intended to be std-only; for `no_std` usage
26/// depend on `micronet-antenna-core` instead.
27pub enum Error {
28 Serialization,
29}
30
31/// Convenience result alias for std wrapper operations.
32pub type Result<T> = core::result::Result<T, Error>;