Attribute Macro netstack3_core::context_ip_bounds

#[context_ip_bounds]
Expand description

Generates common bounds for netstack3_core::UnlockedCoreCtx.

This macro is used to emit a common where clause when writing code that is generic over IP version that wants to call into netstack3 core.

It takes up to three arguments:

#[context_ip_bounds(IpIdentifier, BindingsCtx [,netstack3_core]]
  • IpIdentifier is the generic IP type for the targeted item. Required.
  • BindingsCtx is the bindings context implementation in use. Required.
  • netstack3_core is the path to the root of the netstack3 core crate. Optional, assumed to be netstack3_core if omitted.

Example:

#[context_ip_bounds(I, FooBindingsCtx)]
impl<I: netstack3_core::IpExt> Foo {}

Expands to:

impl<I: netstack3_core::IpExt> Foo
where
    for<'a> netstack3_core::UnlockedCoreCtx<'a, FooBindingsCtx>:
            netstack3_core::CoreContext<I, FooBindingsCtx>,
    FooBindingsCtx: netstack3_core::IpBindingsContext<I> {}