123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #![cfg_attr(feature = "use_alloc", feature(alloc))]
- #![no_std]
- extern crate byteorder;
- #[cfg(any(test, feature = "use_std"))]
- #[macro_use]
- extern crate std;
- #[cfg(feature = "use_std")]
- extern crate libc;
- #[cfg(feature = "use_alloc")]
- extern crate alloc;
- #[cfg(feature = "use_log")]
- #[macro_use(trace, log)]
- extern crate log;
- macro_rules! net_trace {
- ($($arg:expr),*) => {
- #[cfg(feature = "use_log")]
- trace!($($arg),*);
- #[cfg(not(feature = "use_log"))]
- $( let _ = $arg );*;
- }
- }
- use core::fmt;
- mod managed;
- pub mod phy;
- pub mod wire;
- pub mod iface;
- pub mod socket;
- pub use managed::Managed;
- #[derive(Debug, PartialEq, Eq, Clone, Copy)]
- pub enum Error {
-
-
- Truncated,
-
-
- Unrecognized,
-
-
-
- Malformed,
-
- Checksum,
-
- Fragmented,
-
-
-
- Unaddressable,
-
- Exhausted,
-
- Rejected,
- #[doc(hidden)]
- __Nonexhaustive
- }
- impl fmt::Display for Error {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match self {
- &Error::Truncated => write!(f, "truncated packet"),
- &Error::Unrecognized => write!(f, "unrecognized packet"),
- &Error::Malformed => write!(f, "malformed packet"),
- &Error::Checksum => write!(f, "checksum error"),
- &Error::Fragmented => write!(f, "fragmented packet"),
- &Error::Unaddressable => write!(f, "unaddressable destination"),
- &Error::Exhausted => write!(f, "buffer space exhausted"),
- &Error::Rejected => write!(f, "rejected by socket"),
- &Error::__Nonexhaustive => unreachable!()
- }
- }
- }
|