|
@@ -17,26 +17,26 @@ use super::{ArpCache};
|
|
/// a dependency on heap allocation, it instead owns a `BorrowMut<[T]>`, which can be
|
|
/// a dependency on heap allocation, it instead owns a `BorrowMut<[T]>`, which can be
|
|
/// a `&mut [T]`, or `Vec<T>` if a heap is available.
|
|
/// a `&mut [T]`, or `Vec<T>` if a heap is available.
|
|
#[derive(Debug)]
|
|
#[derive(Debug)]
|
|
-pub struct Interface<'a,
|
|
|
|
|
|
+pub struct Interface<'a, 'b: 'a,
|
|
DeviceT: Device,
|
|
DeviceT: Device,
|
|
ArpCacheT: ArpCache,
|
|
ArpCacheT: ArpCache,
|
|
ProtocolAddrsT: BorrowMut<[InternetAddress]>,
|
|
ProtocolAddrsT: BorrowMut<[InternetAddress]>,
|
|
- SocketsT: BorrowMut<[Socket<'a>]>
|
|
|
|
|
|
+ SocketsT: BorrowMut<[Socket<'a, 'b>]>
|
|
> {
|
|
> {
|
|
device: DeviceT,
|
|
device: DeviceT,
|
|
arp_cache: ArpCacheT,
|
|
arp_cache: ArpCacheT,
|
|
hardware_addr: EthernetAddress,
|
|
hardware_addr: EthernetAddress,
|
|
protocol_addrs: ProtocolAddrsT,
|
|
protocol_addrs: ProtocolAddrsT,
|
|
sockets: SocketsT,
|
|
sockets: SocketsT,
|
|
- phantom: PhantomData<Socket<'a>>
|
|
|
|
|
|
+ phantom: PhantomData<Socket<'a, 'b>>
|
|
}
|
|
}
|
|
|
|
|
|
-impl<'a,
|
|
|
|
|
|
+impl<'a, 'b: 'a,
|
|
DeviceT: Device,
|
|
DeviceT: Device,
|
|
ArpCacheT: ArpCache,
|
|
ArpCacheT: ArpCache,
|
|
ProtocolAddrsT: BorrowMut<[InternetAddress]>,
|
|
ProtocolAddrsT: BorrowMut<[InternetAddress]>,
|
|
- SocketsT: BorrowMut<[Socket<'a>]>
|
|
|
|
-> Interface<'a, DeviceT, ArpCacheT, ProtocolAddrsT, SocketsT> {
|
|
|
|
|
|
+ SocketsT: BorrowMut<[Socket<'a, 'b>]>
|
|
|
|
+> Interface<'a, 'b, DeviceT, ArpCacheT, ProtocolAddrsT, SocketsT> {
|
|
/// Create a network interface using the provided network device.
|
|
/// Create a network interface using the provided network device.
|
|
///
|
|
///
|
|
/// # Panics
|
|
/// # Panics
|
|
@@ -44,7 +44,7 @@ impl<'a,
|
|
/// and [set_protocol_addrs](#method.set_protocol_addrs) functions.
|
|
/// and [set_protocol_addrs](#method.set_protocol_addrs) functions.
|
|
pub fn new(device: DeviceT, arp_cache: ArpCacheT, hardware_addr: EthernetAddress,
|
|
pub fn new(device: DeviceT, arp_cache: ArpCacheT, hardware_addr: EthernetAddress,
|
|
protocol_addrs: ProtocolAddrsT, sockets: SocketsT) ->
|
|
protocol_addrs: ProtocolAddrsT, sockets: SocketsT) ->
|
|
- Interface<'a, DeviceT, ArpCacheT, ProtocolAddrsT, SocketsT> {
|
|
|
|
|
|
+ Interface<'a, 'b, DeviceT, ArpCacheT, ProtocolAddrsT, SocketsT> {
|
|
Self::check_hardware_addr(&hardware_addr);
|
|
Self::check_hardware_addr(&hardware_addr);
|
|
Self::check_protocol_addrs(protocol_addrs.borrow());
|
|
Self::check_protocol_addrs(protocol_addrs.borrow());
|
|
Interface {
|
|
Interface {
|
|
@@ -106,7 +106,7 @@ impl<'a,
|
|
}
|
|
}
|
|
|
|
|
|
/// Get the set of sockets owned by the interface.
|
|
/// Get the set of sockets owned by the interface.
|
|
- pub fn sockets(&mut self) -> &mut [Socket<'a>] {
|
|
|
|
|
|
+ pub fn sockets(&mut self) -> &mut [Socket<'a, 'b>] {
|
|
self.sockets.borrow_mut()
|
|
self.sockets.borrow_mut()
|
|
}
|
|
}
|
|
|
|
|