pub(crate) fn add_ip_addr_subnet<D: EventDispatcher, A: IpAddress>(
    ctx: &mut Ctx<D>,
    device: DeviceId,
    addr_sub: AddrSubnet<A>,
) -> Result<(), ExistsError> {
    // `device` must be initialized.
    assert!(is_device_initialized(&ctx.state, device));

    trace!("add_ip_addr_subnet: adding addr {:?} to device {:?}", addr_sub, device);

    match addr_sub.into() {
        AddrSubnetEither::V4(addr_sub) => {
            crate::ip::device::add_ipv4_addr_subnet(ctx, device, addr_sub)
                .map(|()| crate::ip::on_routing_state_updated::<Ipv4, _>(ctx))
        }
        AddrSubnetEither::V6(addr_sub) => {
            crate::ip::device::add_ipv6_addr_subnet(ctx, device, addr_sub, AddrConfig::Manual)
                .map(|()| crate::ip::on_routing_state_updated::<Ipv6, _>(ctx))
        }
    }
}
/// Adds an IP address and associated subnet to this device.
///
/// For IPv6, this function also joins the solicited-node multicast group and
/// begins performing Duplicate Address Detection (DAD).
///
/// # Panics
///
/// Panics if `device` is not initialized.
Adds an IP address and associated subnet to this device.
For IPv6, this function also joins the solicited-node multicast group and
begins performing Duplicate Address Detection (DAD).
Adds an IP address and associated subnet to this device . For IPv6 this function also joins the solicited - node multicast group and begins performing Duplicate Address Detection ( DAD ) .
pub(crate) fn add_ip_addr_subnet<D: EventDispatcher, A: IpAddress>(
    ctx: &mut Ctx<D>,
    device: DeviceId,
    addr_sub: AddrSubnet<A>,
) -> Result<(), ExistsError> {
    // `device` must be initialized.
    assert!(is_device_initialized(&ctx.state, device));
    trace!("add_ip_addr_subnet: adding addr {:?} to device {:?}", addr_sub, device);
    match addr_sub.into() {
        AddrSubnetEither::V4(addr_sub) => {
            crate::ip::device::add_ipv4_addr_subnet(ctx, device, addr_sub)
                .map(|()| crate::ip::on_routing_state_updated::<Ipv4, _>(ctx))
        }
        AddrSubnetEither::V6(addr_sub) => {
            crate::ip::device::add_ipv6_addr_subnet(ctx, device, addr_sub, AddrConfig::Manual)
                .map(|()| crate::ip::on_routing_state_updated::<Ipv6, _>(ctx))
        }
    }
}
pub ( crate ) fn add_ip_addr_subnet < D : EventDispatcher , A : IpAddress > ( ctx : & mut Ctx < D > , device : DeviceId , addr_sub : AddrSubnet < A > , ) -> Result < ( ) , ExistsError > { // `device` must be initialized. assert ! ( is_device_initialized ( ctx state device ) ) ; trace ! ( " " addr_sub device ) ; match addr_sub . into ( ) { AddrSubnetEither :: V4 ( addr_sub ) => { crate :: ip :: device :: add_ipv4_addr_subnet ( ctx , device , addr_sub ) . map ( | ( ) | crate :: ip :: on_routing_state_updated :: < Ipv4 , _ > ( ctx ) ) } AddrSubnetEither :: V6 ( addr_sub ) => { crate :: ip :: device :: add_ipv6_addr_subnet ( ctx , device , addr_sub , AddrConfig :: Manual ) . map ( | ( ) | crate :: ip :: on_routing_state_updated :: < Ipv6 , _ > ( ctx ) ) } } }
Adds an IP address and associated subnet to this device.
Adds an IP address and associated subnet to this device .
ctx
&mut Ctx<D>
device
DeviceId
addr_sub
AddrSubnet<A>
ctx
&mut Ctx<D>
device
DeviceId
addr_sub
AddrSubnet<A>
panics
Panics if `device` is not initialized.
Panics if ` device ` is not initialized .