浏览代码

Rename into_lower → into_inner.

whitequark 7 年之前
父节点
当前提交
ac988f699b
共有 2 个文件被更改,包括 16 次插入16 次删除
  1. 8 8
      src/phy/fault_injector.rs
  2. 8 8
      src/phy/tracer.rs

+ 8 - 8
src/phy/fault_injector.rs

@@ -109,14 +109,14 @@ impl State {
 /// or hardware limitations (such as a limited number or size of usable network buffers).
 #[derive(Debug)]
 pub struct FaultInjector<D: Device> {
-    lower:  D,
+    inner:  D,
     state:  State,
     config: Config
 }
 
 impl<D: Device> FaultInjector<D> {
     /// Create a fault injector device, using the given random number generator seed.
-    pub fn new(lower: D, seed: u32) -> FaultInjector<D> {
+    pub fn new(inner: D, seed: u32) -> FaultInjector<D> {
         #[cfg(feature = "std")]
         let state = State {
             rng_seed:    seed,
@@ -129,15 +129,15 @@ impl<D: Device> FaultInjector<D> {
             rng_seed:    seed,
         };
         FaultInjector {
-            lower: lower,
+            inner: inner,
             state: state,
             config: Config::default()
         }
     }
 
     /// Return the underlying device, consuming the fault injector.
-    pub fn into_lower(self) -> D {
-        self.lower
+    pub fn into_inner(self) -> D {
+        self.inner
     }
 
     /// Return the probability of corrupting a packet, in percents.
@@ -222,7 +222,7 @@ impl<D: Device> Device for FaultInjector<D>
     type TxBuffer = TxBuffer<D::TxBuffer>;
 
     fn limits(&self) -> DeviceLimits {
-        let mut limits = self.lower.limits();
+        let mut limits = self.inner.limits();
         if limits.max_transmission_unit > MTU {
             limits.max_transmission_unit = MTU;
         }
@@ -230,7 +230,7 @@ impl<D: Device> Device for FaultInjector<D>
     }
 
     fn receive(&mut self, timestamp: u64) -> Result<Self::RxBuffer, Error> {
-        let mut buffer = self.lower.receive(timestamp)?;
+        let mut buffer = self.inner.receive(timestamp)?;
         if self.state.maybe(self.config.drop_pct) {
             net_trace!("rx: randomly dropping a packet");
             return Err(Error::Exhausted)
@@ -262,7 +262,7 @@ impl<D: Device> Device for FaultInjector<D>
             net_trace!("tx: dropping a packet because of rate limiting");
             buffer = None;
         } else {
-            buffer = Some(self.lower.transmit(timestamp, length)?);
+            buffer = Some(self.inner.transmit(timestamp, length)?);
         }
         Ok(TxBuffer {
             buffer: buffer,

+ 8 - 8
src/phy/tracer.rs

@@ -8,22 +8,22 @@ use super::{DeviceLimits, Device};
 /// using the provided writer function, and then passes them to another
 /// device.
 pub struct Tracer<D: Device, P: PrettyPrint> {
-    lower:     D,
+    inner:     D,
     writer:    fn(u64, PrettyPrinter<P>)
 }
 
 impl<D: Device, P: PrettyPrint> Tracer<D, P> {
     /// Create a tracer device.
-    pub fn new(lower: D, writer: fn(timestamp: u64, printer: PrettyPrinter<P>)) -> Tracer<D, P> {
+    pub fn new(inner: D, writer: fn(timestamp: u64, printer: PrettyPrinter<P>)) -> Tracer<D, P> {
         Tracer {
-            lower:   lower,
+            inner:   inner,
             writer:  writer
         }
     }
 
     /// Return the underlying device, consuming the tracer.
-    pub fn into_lower(self) -> D {
-        self.lower
+    pub fn into_inner(self) -> D {
+        self.inner
     }
 }
 
@@ -31,16 +31,16 @@ impl<D: Device, P: PrettyPrint> Device for Tracer<D, P> {
     type RxBuffer = D::RxBuffer;
     type TxBuffer = TxBuffer<D::TxBuffer, P>;
 
-    fn limits(&self) -> DeviceLimits { self.lower.limits() }
+    fn limits(&self) -> DeviceLimits { self.inner.limits() }
 
     fn receive(&mut self, timestamp: u64) -> Result<Self::RxBuffer, Error> {
-        let buffer = self.lower.receive(timestamp)?;
+        let buffer = self.inner.receive(timestamp)?;
         (self.writer)(timestamp, PrettyPrinter::<P>::new("<- ", &buffer));
         Ok(buffer)
     }
 
     fn transmit(&mut self, timestamp: u64, length: usize) -> Result<Self::TxBuffer, Error> {
-        let buffer = self.lower.transmit(timestamp, length)?;
+        let buffer = self.inner.transmit(timestamp, length)?;
         Ok(TxBuffer { buffer, timestamp, writer: self.writer })
     }
 }