Răsfoiți Sursa

Remove crate::{Error, Result}.

Dario Nieuwenhuis 2 ani în urmă
părinte
comite
84cea137a2
2 a modificat fișierele cu 0 adăugiri și 78 ștergeri
  1. 0 77
      src/lib.rs
  2. 0 1
      src/phy/mod.rs

+ 0 - 77
src/lib.rs

@@ -124,8 +124,6 @@ compile_error!("If you enable the socket feature, you must enable at least one o
 #[cfg(all(feature = "defmt", feature = "log"))]
 compile_error!("You must enable at most one of the following features: defmt, log");
 
-use core::fmt;
-
 #[macro_use]
 mod macros;
 mod parsers;
@@ -144,78 +142,3 @@ pub mod socket;
 pub mod storage;
 pub mod time;
 pub mod wire;
-
-/// The error type for the networking stack.
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-#[non_exhaustive]
-#[cfg_attr(feature = "defmt", derive(defmt::Format))]
-pub enum Error {
-    /// An operation cannot proceed because a buffer is empty or full.
-    Exhausted,
-    /// An operation is not permitted in the current state.
-    Illegal,
-    /// An endpoint or address of a remote host could not be translated to a lower level address.
-    /// E.g. there was no an Ethernet address corresponding to an IPv4 address in the ARP cache,
-    /// or a TCP connection attempt was made to an unspecified endpoint.
-    Unaddressable,
-
-    /// The operation is finished.
-    /// E.g. when reading from a TCP socket, there's no more data to read because the remote
-    /// has closed the connection.
-    Finished,
-
-    /// An incoming packet could not be parsed because some of its fields were out of bounds
-    /// of the received data.
-    Truncated,
-    /// An incoming packet had an incorrect checksum and was dropped.
-    Checksum,
-    /// An incoming packet could not be recognized and was dropped.
-    /// E.g. an Ethernet packet with an unknown EtherType.
-    Unrecognized,
-    /// An incoming IP packet has been split into several IP fragments and was dropped,
-    /// since IP reassembly is not supported.
-    Fragmented,
-    /// An incoming packet was recognized but was self-contradictory.
-    /// E.g. a TCP packet with both SYN and FIN flags set.
-    Malformed,
-    /// An incoming packet was recognized but contradicted internal state.
-    /// E.g. a TCP packet addressed to a socket that doesn't exist.
-    Dropped,
-    /// An incoming fragment arrived too late.
-    ReassemblyTimeout,
-
-    /// An incoming packet was recognized but some parts are not supported by smoltcp.
-    /// E.g. some bit configuration in a packet header is not supported, but is defined in an RFC.
-    NotSupported,
-}
-
-#[cfg(feature = "std")]
-impl std::error::Error for Error {}
-
-/// The result type for the networking stack.
-pub type Result<T> = core::result::Result<T, Error>;
-
-impl fmt::Display for Error {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match *self {
-            Error::Exhausted => write!(f, "buffer space exhausted"),
-            Error::Illegal => write!(f, "illegal operation"),
-            Error::Unaddressable => write!(f, "unaddressable destination"),
-            Error::Finished => write!(f, "operation finished"),
-            Error::Truncated => write!(f, "truncated packet"),
-            Error::Checksum => write!(f, "checksum error"),
-            Error::Unrecognized => write!(f, "unrecognized packet"),
-            Error::Fragmented => write!(f, "fragmented packet"),
-            Error::Malformed => write!(f, "malformed packet"),
-            Error::Dropped => write!(f, "dropped by socket"),
-            Error::ReassemblyTimeout => write!(f, "incoming fragment arrived too late"),
-            Error::NotSupported => write!(f, "not supported by smoltcp"),
-        }
-    }
-}
-
-impl From<wire::Error> for Error {
-    fn from(_: wire::Error) -> Self {
-        Error::Malformed
-    }
-}

+ 0 - 1
src/phy/mod.rs

@@ -20,7 +20,6 @@ An implementation of the [Device](trait.Device.html) trait for a simple hardware
 Ethernet controller could look as follows:
 
 ```rust
-use smoltcp::Result;
 use smoltcp::phy::{self, DeviceCapabilities, Device, Medium};
 use smoltcp::time::Instant;