From 2c1e234b91c85fe751a7bc0ea86b46cd8dc6495f Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 29 Jun 2017 15:56:03 +0000 Subject: [PATCH] Remove Socket::{process,dispatch} from public interface. These no longer have to be public, since our required Rust version has pub(crate). In addition Socket::process is not used at all. --- src/socket/mod.rs | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/socket/mod.rs b/src/socket/mod.rs index 7e1889a..434a263 100644 --- a/src/socket/mod.rs +++ b/src/socket/mod.rs @@ -81,27 +81,8 @@ impl<'a, 'b> Socket<'a, 'b> { dispatch_socket!(self, |socket [mut]| socket.set_debug_id(id)) } - /// Process a packet received from a network interface. - /// - /// This function checks if the packet contained in the payload matches the socket endpoint, - /// and if it does, copies it into the internal buffer, otherwise, `Err(Error::Rejected)` - /// is returned. - /// - /// This function is used internally by the networking stack. - pub fn process(&mut self, timestamp: u64, ip_repr: &IpRepr, - payload: &[u8]) -> Result<(), Error> { - dispatch_socket!(self, |socket [mut]| socket.process(timestamp, ip_repr, payload)) - } - - /// Prepare a packet to be transmitted to a network interface. - /// - /// This function checks if the internal buffer is empty, and if it is not, calls `f` with - /// the representation of the packet to be transmitted, otherwise, `Err(Error::Exhausted)` - /// is returned. - /// - /// This function is used internally by the networking stack. - pub fn dispatch(&mut self, timestamp: u64, limits: &DeviceLimits, - emit: &mut F) -> Result + pub(crate) fn dispatch(&mut self, timestamp: u64, limits: &DeviceLimits, + emit: &mut F) -> Result where F: FnMut(&IpRepr, &IpPayload) -> Result { dispatch_socket!(self, |socket [mut]| socket.dispatch(timestamp, limits, emit)) }