pub fn remove_device<D: EventDispatcher>(ctx: &mut Ctx<D>, device: DeviceId) -> Option<Vec<usize>> {
    match device.inner() {
        DeviceIdInner::Ethernet(id) => {
            // TODO(rheacock): Generate any final frames to send here.
            crate::device::ethernet::deinitialize(ctx, id);
            let EthernetDeviceId(id) = id;
            let _: DeviceState<_> = ctx
                .state
                .device
                .ethernet
                .remove(id)
                .unwrap_or_else(|| panic!("no such Ethernet device: {}", id));
            debug!("removing Ethernet device with ID {}", id);
            None
        }
        DeviceIdInner::Loopback => {
            let _: DeviceState<_> =
                ctx.state.device.loopback.take().expect("loopback device does not exist");
            debug!("removing Loopback device");
            None
        }
    }
}
/// Remove a device from the device layer.
///
/// This function returns frames for the bindings to send if the shutdown is
/// graceful - they can be safely ignored otherwise.
///
/// # Panics
///
/// Panics if `device` does not refer to an existing device.
Remove a device from the device layer.
This function returns frames for the bindings to send if the shutdown is
graceful - they can be safely ignored otherwise.
Remove a device from the device layer . This function returns frames for the bindings to send if the shutdown is graceful - they can be safely ignored otherwise .
pub fn remove_device<D: EventDispatcher>(ctx: &mut Ctx<D>, device: DeviceId) -> Option<Vec<usize>> {
    match device.inner() {
        DeviceIdInner::Ethernet(id) => {
            // TODO(rheacock): Generate any final frames to send here.
            crate::device::ethernet::deinitialize(ctx, id);
            let EthernetDeviceId(id) = id;
            let _: DeviceState<_> = ctx
                .state
                .device
                .ethernet
                .remove(id)
                .unwrap_or_else(|| panic!("no such Ethernet device: {}", id));
            debug!("removing Ethernet device with ID {}", id);
            None
        }
        DeviceIdInner::Loopback => {
            let _: DeviceState<_> =
                ctx.state.device.loopback.take().expect("loopback device does not exist");
            debug!("removing Loopback device");
            None
        }
    }
}
pub fn remove_device < D : EventDispatcher > ( ctx : & mut Ctx < D > , device : DeviceId ) -> Option < Vec < usize > > { match device . inner ( ) { DeviceIdInner :: Ethernet ( id ) => { // TODO(rheacock): Generate any final frames to send here. crate :: device :: ethernet :: deinitialize ( ctx , id ) ; let EthernetDeviceId ( id ) = id ; let _ : DeviceState < _ > = ctx . state . device . ethernet . remove ( id ) . unwrap_or_else ( | | panic ! ( " " id ) ) ; debug ! ( " " id ) ; None } DeviceIdInner :: Loopback => { let _ : DeviceState < _ > = ctx . state . device . loopback . take ( ) . expect ( " " ) ; debug ! ( " " ) ; None } } }
Remove a device from the device layer.
Remove a device from the device layer .
ctx
&mut Ctx<D>
device
DeviceId
ctx
&mut Ctx<D>
device
DeviceId
panics
Panics if `device` does not refer to an existing device.
Panics if ` device ` does not refer to an existing device .