Enum bgpkit_parser::models::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 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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.