pub struct FlowSpecRule {
pub components: Vec<FlowSpecComponent>,
}Expand description
A complete FlowSpec NLRI rule — an ordered set of match components.
Components must be sorted by ascending type code. A rule may contain at most one component of each type.
Fields§
§components: Vec<FlowSpecComponent>Ordered match components (ascending type code).
Implementations§
Source§impl FlowSpecRule
impl FlowSpecRule
Sourcepub fn validate(&self) -> Result<(), DecodeError>
pub fn validate(&self) -> Result<(), DecodeError>
Validate that components are in ascending type-code order.
§Errors
Returns DecodeError if the rule has no components or if components
are not in strictly ascending type-code order.
Sourcepub fn encoded_len(&self, afi: Afi) -> usize
pub fn encoded_len(&self, afi: Afi) -> usize
Return this rule’s encoded FlowSpec NLRI payload length, excluding
the one- or two-byte FlowSpec rule length prefix.
Sourcepub fn validate_encoded_len(&self, afi: Afi) -> Result<(), EncodeError>
pub fn validate_encoded_len(&self, afi: Afi) -> Result<(), EncodeError>
Validate that this rule can be represented by FlowSpec’s 12-bit rule
length field.
§Errors
Returns EncodeError if the encoded rule exceeds 4095 bytes.
Sourcepub fn display_string(&self) -> String
pub fn display_string(&self) -> String
Return a human-readable display string for logging / gRPC.
Sourcepub fn destination_prefix(&self) -> Option<Prefix>
pub fn destination_prefix(&self) -> Option<Prefix>
Extract the destination prefix from the rule, if present.
Trait Implementations§
Source§impl Clone for FlowSpecRule
impl Clone for FlowSpecRule
Source§fn clone(&self) -> FlowSpecRule
fn clone(&self) -> FlowSpecRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FlowSpecRule
impl Debug for FlowSpecRule
Source§impl Display for FlowSpecRule
impl Display for FlowSpecRule
impl Eq for FlowSpecRule
Source§impl Hash for FlowSpecRule
impl Hash for FlowSpecRule
Source§impl Ord for FlowSpecRule
impl Ord for FlowSpecRule
Source§fn cmp(&self, other: &FlowSpecRule) -> Ordering
fn cmp(&self, other: &FlowSpecRule) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for FlowSpecRule
impl PartialEq for FlowSpecRule
Source§fn eq(&self, other: &FlowSpecRule) -> bool
fn eq(&self, other: &FlowSpecRule) -> bool
self and other values to be equal, and is used by ==.