pub struct RuleAddRequest<T = ()> { /* private fields */ }Expand description
A request to create a new rule. This is equivalent to the ip rule add
command.
Implementations§
Source§impl<T> RuleAddRequest<T>
impl<T> RuleAddRequest<T>
Sourcepub fn input_interface(self, ifname: String) -> Self
pub fn input_interface(self, ifname: String) -> Self
Sets the input interface name.
Sourcepub fn output_interface(self, ifname: String) -> Self
pub fn output_interface(self, ifname: String) -> Self
Sets the output interface name.
Sourcepub fn table(self, table: u8) -> Self
👎Deprecated: Please use table_id instead
pub fn table(self, table: u8) -> Self
table_id insteadSets the rule table.
Default is main rule table.
Sourcepub fn action(self, action: RuleAction) -> Self
pub fn action(self, action: RuleAction) -> Self
Set action.
Sourcepub fn v4(self) -> RuleAddRequest<Ipv4Addr>
pub fn v4(self) -> RuleAddRequest<Ipv4Addr>
Build an IP v4 rule
Sourcepub fn v6(self) -> RuleAddRequest<Ipv6Addr>
pub fn v6(self) -> RuleAddRequest<Ipv6Addr>
Build an IP v6 rule
pub fn message_mut(&mut self) -> &mut RuleMessage
Source§impl RuleAddRequest<Ipv4Addr>
impl RuleAddRequest<Ipv4Addr>
Sourcepub fn source_prefix(self, addr: Ipv4Addr, prefix_length: u8) -> Self
pub fn source_prefix(self, addr: Ipv4Addr, prefix_length: u8) -> Self
Sets the source address prefix.
Sourcepub fn destination_prefix(self, addr: Ipv4Addr, prefix_length: u8) -> Self
pub fn destination_prefix(self, addr: Ipv4Addr, prefix_length: u8) -> Self
Sets the destination address prefix.
Source§impl RuleAddRequest<Ipv6Addr>
impl RuleAddRequest<Ipv6Addr>
Sourcepub fn source_prefix(self, addr: Ipv6Addr, prefix_length: u8) -> Self
pub fn source_prefix(self, addr: Ipv6Addr, prefix_length: u8) -> Self
Sets the source address prefix.
Sourcepub fn destination_prefix(self, addr: Ipv6Addr, prefix_length: u8) -> Self
pub fn destination_prefix(self, addr: Ipv6Addr, prefix_length: u8) -> Self
Sets the destination address prefix.
Trait Implementations§
Source§impl<T: Clone> Clone for RuleAddRequest<T>
impl<T: Clone> Clone for RuleAddRequest<T>
Source§fn clone(&self) -> RuleAddRequest<T>
fn clone(&self) -> RuleAddRequest<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for RuleAddRequest<T>
impl<T = ()> !RefUnwindSafe for RuleAddRequest<T>
impl<T> Send for RuleAddRequest<T>where
T: Send,
impl<T> Sync for RuleAddRequest<T>where
T: Sync,
impl<T> Unpin for RuleAddRequest<T>where
T: Unpin,
impl<T = ()> !UnwindSafe for RuleAddRequest<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more