Reorder type parameters of Interface.

v0.7.x
whitequark 2017-01-01 08:18:25 +00:00
parent 716a1cf7fe
commit 08ac98e4bc
2 changed files with 11 additions and 11 deletions

View File

@ -82,11 +82,11 @@ fn main() {
let tcp2_tx_buffer = TcpSocketBuffer::new(vec![0; 128]);
let tcp2_socket = TcpSocket::new(tcp2_rx_buffer, tcp2_tx_buffer);
let hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x01]);
let hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x01]);
let protocol_addrs = [IpAddress::v4(192, 168, 69, 1)];
let sockets = vec![udp_socket, tcp1_socket, tcp2_socket];
let mut iface = EthernetInterface::new(device, arp_cache,
hardware_addr, protocol_addrs, sockets);
let sockets = vec![udp_socket, tcp1_socket, tcp2_socket];
let mut iface = EthernetInterface::new(device, hardware_addr, protocol_addrs,
arp_cache, sockets);
let mut tcp_6969_connected = false;
loop {

View File

@ -20,32 +20,32 @@ use super::{ArpCache};
#[derive(Debug)]
pub struct Interface<'a, 'b: 'a,
DeviceT: Device,
ArpCacheT: ArpCache,
ProtocolAddrsT: BorrowMut<[IpAddress]>,
ArpCacheT: ArpCache,
SocketsT: BorrowMut<[Socket<'a, 'b>]>
> {
device: DeviceT,
arp_cache: ArpCacheT,
hardware_addr: EthernetAddress,
protocol_addrs: ProtocolAddrsT,
arp_cache: ArpCacheT,
sockets: SocketsT,
phantom: PhantomData<Socket<'a, 'b>>
}
impl<'a, 'b: 'a,
DeviceT: Device,
ArpCacheT: ArpCache,
ProtocolAddrsT: BorrowMut<[IpAddress]>,
ArpCacheT: ArpCache,
SocketsT: BorrowMut<[Socket<'a, 'b>]>
> Interface<'a, 'b, DeviceT, ArpCacheT, ProtocolAddrsT, SocketsT> {
> Interface<'a, 'b, DeviceT, ProtocolAddrsT, ArpCacheT, SocketsT> {
/// Create a network interface using the provided network device.
///
/// # Panics
/// See the restrictions on [set_hardware_addr](#method.set_hardware_addr)
/// and [set_protocol_addrs](#method.set_protocol_addrs) functions.
pub fn new(device: DeviceT, arp_cache: ArpCacheT, hardware_addr: EthernetAddress,
protocol_addrs: ProtocolAddrsT, sockets: SocketsT) ->
Interface<'a, 'b, DeviceT, ArpCacheT, ProtocolAddrsT, SocketsT> {
pub fn new(device: DeviceT, hardware_addr: EthernetAddress, protocol_addrs: ProtocolAddrsT,
arp_cache: ArpCacheT, sockets: SocketsT) ->
Interface<'a, 'b, DeviceT, ProtocolAddrsT, ArpCacheT, SocketsT> {
Self::check_hardware_addr(&hardware_addr);
Self::check_protocol_addrs(protocol_addrs.borrow());
Interface {