netstack3_ip::device

Trait SlaacAddresses

Source
pub trait SlaacAddresses<BT: SlaacBindingsTypes> {
    type AddrsIter<'x>: Iterator<Item = SlaacAddressEntry<BT::Instant>>;

    // Required methods
    fn for_each_addr_mut<F: FnMut(SlaacAddressEntryMut<'_, BT::Instant>)>(
        &mut self,
        cb: F,
    );
    fn with_addrs<O, F: FnOnce(Self::AddrsIter<'_>) -> O>(&mut self, cb: F) -> O;
    fn add_addr_sub_and_then<O, F: FnOnce(SlaacAddressEntryMut<'_, BT::Instant>, &mut BT) -> O>(
        &mut self,
        bindings_ctx: &mut BT,
        addr_sub: AddrSubnet<Ipv6Addr, Ipv6DeviceAddr>,
        config: Ipv6AddrSlaacConfig<BT::Instant>,
        and_then: F,
    ) -> Result<O, ExistsError>;
    fn remove_addr(
        &mut self,
        bindings_ctx: &mut BT,
        addr: &Ipv6DeviceAddr,
    ) -> Result<(AddrSubnet<Ipv6Addr, Ipv6DeviceAddr>, SlaacConfig<BT::Instant>), NotFoundError>;
}
Expand description

Abstracts iteration over a device’s SLAAC addresses.

Required Associated Types§

Source

type AddrsIter<'x>: Iterator<Item = SlaacAddressEntry<BT::Instant>>

The iterator provided to with_addrs.

Required Methods§

Source

fn for_each_addr_mut<F: FnMut(SlaacAddressEntryMut<'_, BT::Instant>)>( &mut self, cb: F, )

Returns an iterator providing a mutable view of mutable SLAAC address state.

Source

fn with_addrs<O, F: FnOnce(Self::AddrsIter<'_>) -> O>(&mut self, cb: F) -> O

Calls the callback with an iterator over the addresses.

Source

fn add_addr_sub_and_then<O, F: FnOnce(SlaacAddressEntryMut<'_, BT::Instant>, &mut BT) -> O>( &mut self, bindings_ctx: &mut BT, addr_sub: AddrSubnet<Ipv6Addr, Ipv6DeviceAddr>, config: Ipv6AddrSlaacConfig<BT::Instant>, and_then: F, ) -> Result<O, ExistsError>

Adds addr_sub with config to the device and calls and_then with the newly added entry.

Source

fn remove_addr( &mut self, bindings_ctx: &mut BT, addr: &Ipv6DeviceAddr, ) -> Result<(AddrSubnet<Ipv6Addr, Ipv6DeviceAddr>, SlaacConfig<BT::Instant>), NotFoundError>

Removes a SLAAC address.

§Panics

May panic if addr is not an address recognized.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§