RouteMessageBuilder

Struct RouteMessageBuilder 

Source
pub struct RouteMessageBuilder<T = IpAddr> { /* private fields */ }

Implementations§

Source§

impl<T> RouteMessageBuilder<T>

Source

pub fn input_interface(self, index: u32) -> Self

Sets the input interface index.

Source

pub fn output_interface(self, index: u32) -> Self

Sets the output interface index.

Source

pub fn output_mpls(self, labels: Vec<MplsLabel>) -> Self

Sets the output MPLS encapsulation labels.

Source

pub fn multipath(self, nexthops: Vec<RouteNextHop>) -> Self

Sets multiple nexthop entries for the route.

Source

pub fn priority(self, priority: u32) -> Self

Sets the route priority (metric)

Source

pub fn table_id(self, table: u32) -> Self

Sets the route table ID.

Default is main route table.

Source

pub fn protocol(self, protocol: RouteProtocol) -> Self

Sets the route protocol.

Default is static route protocol.

Source

pub fn scope(self, scope: RouteScope) -> Self

Sets the route scope.

Default is universe route scope.

Source

pub fn kind(self, kind: RouteType) -> Self

Sets the route kind.

Default is unicast route kind.

Marks the next hop as directly reachable (on-link).

Indicates that the next hop is reachable without passing through a connected subnet.

Source

pub fn get_mut(&mut self) -> &mut RouteMessage

Return a mutable reference to the request message.

Source

pub fn build(self) -> RouteMessage

Source§

impl RouteMessageBuilder<Ipv4Addr>

Source

pub fn new() -> Self

Create default RouteMessage with header set to:

For using this message in querying routes, these settings are ignored unless NETLINK_GET_STRICT_CHK been enabled.

Source

pub fn source_prefix(self, addr: Ipv4Addr, prefix_length: u8) -> Self

Sets the source address prefix.

Source

pub fn pref_source(self, addr: Ipv4Addr) -> Self

Sets the preferred source address.

Source

pub fn destination_prefix(self, addr: Ipv4Addr, prefix_length: u8) -> Self

Sets the destination address prefix.

Source

pub fn gateway(self, addr: Ipv4Addr) -> Self

Sets the gateway (via) address.

Source

pub fn via(self, addr: Ipv6Addr) -> Self

Sets the IPv6 gateway (via) address.

Source§

impl RouteMessageBuilder<Ipv6Addr>

Source

pub fn new() -> Self

Create default RouteMessage with header set to:

For using this message in querying routes, these settings are ignored unless NETLINK_GET_STRICT_CHK been enabled.

Source

pub fn source_prefix(self, addr: Ipv6Addr, prefix_length: u8) -> Self

Sets the source address prefix.

Source

pub fn pref_source(self, addr: Ipv6Addr) -> Self

Sets the preferred source address.

Source

pub fn destination_prefix(self, addr: Ipv6Addr, prefix_length: u8) -> Self

Sets the destination address prefix.

Source

pub fn gateway(self, addr: Ipv6Addr) -> Self

Sets the gateway (via) address.

Source§

impl RouteMessageBuilder<IpAddr>

Source

pub fn new() -> Self

Source

pub fn source_prefix( self, addr: IpAddr, prefix_length: u8, ) -> Result<Self, InvalidRouteMessage>

Sets the source address prefix.

Source

pub fn pref_source(self, addr: IpAddr) -> Result<Self, InvalidRouteMessage>

Sets the preferred source address.

Source

pub fn destination_prefix( self, addr: IpAddr, prefix_length: u8, ) -> Result<Self, InvalidRouteMessage>

Sets the destination address prefix.

Source

pub fn gateway(self, addr: IpAddr) -> Result<Self, InvalidRouteMessage>

Sets the gateway (via) address.

Source§

impl RouteMessageBuilder<MplsLabel>

Source

pub fn new() -> Self

Create default RouteMessage with header set to:

For using this message in querying routes, these settings are ignored unless NETLINK_GET_STRICT_CHK been enabled.

Source

pub fn label(self, label: MplsLabel) -> Self

Sets the destination MPLS label.

Source

pub fn via(self, addr: IpAddr) -> Self

Sets the gateway (via) address.

Trait Implementations§

Source§

impl<T: Clone> Clone for RouteMessageBuilder<T>

Source§

fn clone(&self) -> RouteMessageBuilder<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for RouteMessageBuilder<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RouteMessageBuilder<IpAddr>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for RouteMessageBuilder<Ipv4Addr>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for RouteMessageBuilder<Ipv6Addr>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for RouteMessageBuilder<MplsLabel>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for RouteMessageBuilder<T>

§

impl<T> RefUnwindSafe for RouteMessageBuilder<T>
where T: RefUnwindSafe,

§

impl<T> Send for RouteMessageBuilder<T>
where T: Send,

§

impl<T> Sync for RouteMessageBuilder<T>
where T: Sync,

§

impl<T> Unpin for RouteMessageBuilder<T>
where T: Unpin,

§

impl<T> UnwindSafe for RouteMessageBuilder<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.