pub struct RouteAddRequest<T = ()> { /* private fields */ }
Expand description

A request to create a new route. This is equivalent to the ip route add commands.

Implementations§

source§

impl<T> RouteAddRequest<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 priority(self, priority: u32) -> Self

Sets the route priority (metric)

source

pub fn table(self, table: u8) -> Self

👎Deprecated: Please use table_id instead

Sets the route table.

Default is main route table.

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.

source

pub fn v4(self) -> RouteAddRequest<Ipv4Addr>

Build an IP v4 route request

source

pub fn v6(self) -> RouteAddRequest<Ipv6Addr>

Build an IP v6 route request

source

pub fn replace(self) -> Self

Replace existing matching route.

source

pub async fn execute(self) -> Result<(), Error>

Execute the request.

source

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

Return a mutable reference to the request message.

source§

impl RouteAddRequest<Ipv4Addr>

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§

impl RouteAddRequest<Ipv6Addr>

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.

Auto Trait Implementations§

§

impl<T = ()> !RefUnwindSafe for RouteAddRequest<T>

§

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

§

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

§

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

§

impl<T = ()> !UnwindSafe for RouteAddRequest<T>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.