Enum bgpkit_parser::models::attributes::AsPathSegment
source · pub enum AsPathSegment {
AsSequence(Vec<Asn>),
AsSet(Vec<Asn>),
ConfedSequence(Vec<Asn>),
ConfedSet(Vec<Asn>),
}
Expand description
Enum of AS path segment.
Variants§
Implementations§
source§impl AsPathSegment
impl AsPathSegment
sourcepub fn route_len(&self) -> usize
pub fn route_len(&self) -> usize
Get the number of ASNs this segment adds to the route. For the number of ASNs within the segment use AsPathSegment::len instead.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Ge the total number of ASNs within this segment. For the number of ASNs this segment adds to a packet’s route, use AsPathSegment::route_len instead.
sourcepub fn iter(&self) -> <&Self as IntoIterator>::IntoIter
pub fn iter(&self) -> <&Self as IntoIterator>::IntoIter
Get an iterator over the ASNs within this path segment
sourcepub fn iter_mut(&mut self) -> <&mut Self as IntoIterator>::IntoIter
pub fn iter_mut(&mut self) -> <&mut Self as IntoIterator>::IntoIter
Get a mutable iterator over the ASNs within this path segment
sourcepub fn is_confed(&self) -> bool
pub fn is_confed(&self) -> bool
Gets if a segment represents the local members of an autonomous system confederation.
Shorthand for matches!(x, AsPathSegment::ConfedSequence(_) | AsPathSegment::ConfedSet(_))
.
pub fn to_u32_vec_opt(&self, dedup: bool) -> Option<Vec<u32>>
Trait Implementations§
source§impl AsRef<[Asn]> for AsPathSegment
impl AsRef<[Asn]> for AsPathSegment
source§impl Clone for AsPathSegment
impl Clone for AsPathSegment
source§fn clone(&self) -> AsPathSegment
fn clone(&self) -> AsPathSegment
Returns a copy 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 moresource§impl Debug for AsPathSegment
impl Debug for AsPathSegment
source§impl Hash for AsPathSegment
impl Hash for AsPathSegment
source§impl<'a> IntoIterator for &'a AsPathSegment
impl<'a> IntoIterator for &'a AsPathSegment
source§impl<'a> IntoIterator for &'a mut AsPathSegment
impl<'a> IntoIterator for &'a mut AsPathSegment
source§impl IntoIterator for AsPathSegment
impl IntoIterator for AsPathSegment
source§impl PartialEq for AsPathSegment
impl PartialEq for AsPathSegment
Check for equality of two path segments.
let a = AsPathSegment::sequence([1, 2, 3]);
let b = AsPathSegment::set([1, 2, 3]);
// Sequences must be identical to be considered equivalent
assert_eq!(a, AsPathSegment::sequence([1, 2, 3]));
assert_ne!(a, AsPathSegment::sequence([1, 2, 3, 3]));
// Sets may be reordered, but must contain exactly the same ASNs.
assert_eq!(b, AsPathSegment::set([3, 1, 2]));
assert_ne!(b, AsPathSegment::set([1, 2, 3, 3]));
impl Eq for AsPathSegment
Auto Trait Implementations§
impl Freeze for AsPathSegment
impl RefUnwindSafe for AsPathSegment
impl Send for AsPathSegment
impl Sync for AsPathSegment
impl Unpin for AsPathSegment
impl UnwindSafe for AsPathSegment
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more