Struct bgpkit_parser::models::attributes::Attributes

source ·
pub struct Attributes { /* private fields */ }
Expand description

Convenience wrapper for a list of attributes

Implementations§

source§

impl Attributes

source

pub fn has_attr(&self, ty: AttrType) -> bool

source

pub fn get_attr(&self, ty: AttrType) -> Option<Attribute>

source

pub fn add_attr(&mut self, attr: Attribute)

source

pub fn origin(&self) -> Origin

Get the ORIGIN attribute. In the event that this attribute is not present, Origin::INCOMPLETE will be returned instead.

source

pub fn origin_id(&self) -> Option<BgpIdentifier>

Get the ORIGINATOR_ID attribute if present.

source

pub fn next_hop(&self) -> Option<IpAddr>

Get the NEXT_HOP attribute if present.

Note: Even when this attribute is not present, the next hop address may still be attainable from the MP_REACH_NLRI attribute.

source

pub fn multi_exit_discriminator(&self) -> Option<u32>

source

pub fn local_preference(&self) -> Option<u32>

source

pub fn only_to_customer(&self) -> Option<Asn>

source

pub fn atomic_aggregate(&self) -> bool

source

pub fn aggregator(&self) -> Option<(Asn, BgpIdentifier)>

source

pub fn clusters(&self) -> Option<&[u32]>

source

pub fn as_path(&self) -> Option<&AsPath>

source

pub fn get_reachable_nlri(&self) -> Option<&Nlri>

source

pub fn get_unreachable_nlri(&self) -> Option<&Nlri>

source

pub fn iter_communities(&self) -> MetaCommunitiesIter<'_>

source

pub fn iter(&self) -> <&Self as IntoIterator>::IntoIter

Get an iterator over the held AttributeValues. If you also need attribute flags, consider using Attributes::into_attributes_iter instead.

source

pub fn into_attributes_iter(self) -> impl Iterator<Item = Attribute>

Get an iterator over the held Attributes. If you do no not need attribute flags, consider using Attributes::iter instead.

source§

impl Attributes

source

pub fn encode(&self, add_path: bool, asn_len: AsnLength) -> Bytes

Trait Implementations§

source§

impl Clone for Attributes

source§

fn clone(&self) -> Attributes

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Attributes

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Attributes

source§

fn default() -> Attributes

Returns the “default value” for a type. Read more
source§

impl Extend<Attribute> for Attributes

source§

fn extend<T: IntoIterator<Item = Attribute>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Extend<AttributeValue> for Attributes

source§

fn extend<T: IntoIterator<Item = AttributeValue>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl From<&BgpElem> for Attributes

source§

fn from(value: &BgpElem) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Attribute>> for Attributes

source§

fn from(value: Vec<Attribute>) -> Self

Converts to this type from the input type.
source§

impl FromIterator<Attribute> for Attributes

source§

fn from_iter<T: IntoIterator<Item = Attribute>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromIterator<AttributeValue> for Attributes

source§

fn from_iter<T: IntoIterator<Item = AttributeValue>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<'a> IntoIterator for &'a Attributes

§

type Item = &'a AttributeValue

The type of the elements being iterated over.
§

type IntoIter = Map<Iter<'a, Attribute>, fn(_: &Attribute) -> &AttributeValue>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoIterator for Attributes

§

type Item = AttributeValue

The type of the elements being iterated over.
§

type IntoIter = Map<IntoIter<Attribute>, fn(_: Attribute) -> AttributeValue>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq for Attributes

source§

fn eq(&self, other: &Attributes) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Attributes

source§

impl StructuralPartialEq for Attributes

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more