renet/src/lib.rs

40 lines
896 B
Rust
Raw Normal View History

2016-12-12 15:19:53 +08:00
#![feature(associated_consts, const_fn)]
2016-12-10 17:23:40 +08:00
#![no_std]
2016-12-11 07:15:26 +08:00
extern crate byteorder;
#[cfg(any(test, feature = "std"))]
2016-12-10 17:23:40 +08:00
#[macro_use]
extern crate std;
2016-12-11 07:15:26 +08:00
#[cfg(feature = "std")]
extern crate libc;
2016-12-10 17:23:40 +08:00
2016-12-12 15:19:53 +08:00
use core::fmt;
2016-12-11 02:33:19 +08:00
pub mod phy;
pub mod wire;
2016-12-12 10:39:46 +08:00
pub mod iface;
2016-12-12 15:19:53 +08:00
/// The error type for the networking stack.
#[derive(Debug)]
pub enum Error {
/// A packet could not be parsed or emitted because a field was out of bounds
/// for the underlying buffer.
Truncated,
/// A packet could not be recognized and was dropped.
Unrecognized,
#[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::__Nonexhaustive => unreachable!()
}
}
}