Remove default impl for Device::limits().

We should not assume any default MTU.
v0.7.x
whitequark 2017-07-14 02:06:31 +00:00
parent f3e54966fd
commit 312ff93c86
2 changed files with 9 additions and 4 deletions

View File

@ -12,7 +12,7 @@ use std::collections::VecDeque;
use collections::{Vec, VecDeque};
use Error;
use super::Device;
use super::{Device, DeviceLimits};
/// A loopback interface.
#[derive(Debug)]
@ -32,6 +32,13 @@ impl Device for Loopback {
type RxBuffer = Vec<u8>;
type TxBuffer = TxBuffer;
fn limits(&self) -> DeviceLimits {
DeviceLimits {
max_transmission_unit: 65535,
..DeviceLimits::default()
}
}
fn receive(&mut self) -> Result<Self::RxBuffer, Error> {
match self.0.borrow_mut().pop_front() {
Some(packet) => Ok(packet),

View File

@ -162,9 +162,7 @@ pub trait Device {
type TxBuffer: AsRef<[u8]> + AsMut<[u8]>;
/// Get a description of device limitations.
fn limits(&self) -> DeviceLimits {
DeviceLimits::default()
}
fn limits(&self) -> DeviceLimits;
/// Receive a frame.
///