pub struct Attribute {
pub value: AttributeValue,
pub flag: AttrFlags,
}Expand description
BGP Attribute struct with attribute value and flag
Fields§
§value: AttributeValue§flag: AttrFlagsBitflags serialize as a string like "OPTIONAL | TRANSITIVE".
Implementations§
Source§impl Attribute
impl Attribute
pub const fn is_optional(&self) -> bool
pub const fn is_transitive(&self) -> bool
pub const fn is_partial(&self) -> bool
pub const fn is_extended(&self) -> bool
Source§impl Attribute
impl Attribute
Sourcepub fn encode_to(
&self,
asn_len: AsnLength,
buf: &mut BytesMut,
) -> Result<(), EncodingError>
pub fn encode_to( &self, asn_len: AsnLength, buf: &mut BytesMut, ) -> Result<(), EncodingError>
Append the wire representation of this attribute to buf.
The length-field width follows the attribute’s EXTENDED_LENGTH flag; a
value that does not fit the resulting field yields
EncodingError::ValueTooLarge instead of being truncated.
Trait Implementations§
impl Eq for Attribute
Source§impl Extend<Attribute> for Attributes
impl Extend<Attribute> for Attributes
Source§fn extend<T: IntoIterator<Item = Attribute>>(&mut self, iter: T)
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: T)
fn extend_one(&mut self, item: T)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
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<AttributeValue> for Attribute
impl From<AttributeValue> for Attribute
Source§fn from(value: AttributeValue) -> Self
fn from(value: AttributeValue) -> Self
Converts to this type from the input type.
Source§impl FromIterator<Attribute> for Attributes
impl FromIterator<Attribute> for Attributes
impl StructuralPartialEq for Attribute
Auto Trait Implementations§
impl !Freeze for Attribute
impl Forget for Attribute
impl Move for Attribute
impl RefUnwindSafe for Attributewhere
Asn: RefUnwindSafe,
AsPathSegment: RefUnwindSafe,
MplsLabel: RefUnwindSafe,
Atomic<*mut ()>: RefUnwindSafe,
InternalBitFlags: RefUnwindSafe,
impl Send for Attribute
impl Sync for Attributewhere
SmallVecData<[AsPathSegment; 1]>: Sync,
AsPathSegment: Sync,
RawVecInner: Sync,
SmallVecData<[MplsLabel; 2]>: Sync,
MplsLabel: Sync,
RawTable<(NodeAttributeType, Vec<u8>)>: Sync,
RawTable<(LinkAttributeType, Vec<u8>)>: Sync,
RawTable<(PrefixAttributeType, Vec<u8>)>: Sync,
Bytes: Sync,
InternalBitFlags: Sync,
impl Unpin for Attribute
impl UnsafeUnpin for Attributewhere
*const Asn is !null: UnsafeUnpin,
PhantomData<Asn>: UnsafeUnpin,
*const AsPathSegment is !null: UnsafeUnpin,
PhantomData<AsPathSegment>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Community>: UnsafeUnpin,
PhantomData<ExtendedCommunity>: UnsafeUnpin,
PhantomData<Ipv6AddrExtCommunity>: UnsafeUnpin,
PhantomData<LargeCommunity>: UnsafeUnpin,
PhantomData<u32>: UnsafeUnpin,
PhantomData<NetworkPrefix>: UnsafeUnpin,
PhantomData<LabeledNetworkPrefix>: UnsafeUnpin,
PhantomData<LinkStateNlri>: UnsafeUnpin,
PhantomData<FlowSpecNlri>: UnsafeUnpin,
PhantomData<EvpnNlri>: UnsafeUnpin,
PhantomData<(NodeAttributeType, Vec<u8>)>: UnsafeUnpin,
PhantomData<(LinkAttributeType, Vec<u8>)>: UnsafeUnpin,
PhantomData<(PrefixAttributeType, Vec<u8>)>: UnsafeUnpin,
PhantomData<Tlv>: UnsafeUnpin,
PhantomData<TunnelEncapTlv>: UnsafeUnpin,
*const u8: UnsafeUnpin,
Align8<*mut ()>: UnsafeUnpin,
&'static Vtable: UnsafeUnpin,
PhantomData<RawTlv8>: UnsafeUnpin,
PhantomData<RawTlv8Ext>: UnsafeUnpin,
PhantomData<RawTlv16>: UnsafeUnpin,
PhantomData<DomainPathSegment>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<AigpTlv>: UnsafeUnpin,
PhantomData<Attribute>: UnsafeUnpin,
PhantomData<BgpValidationWarning>: UnsafeUnpin,
InternalBitFlags: UnsafeUnpin,
impl UnwindSafe for Attributewhere
NonNull<Asn>: UnwindSafe,
Asn: UnwindSafe,
NonNull<AsPathSegment>: UnwindSafe,
AsPathSegment: UnwindSafe,
RawVecInner: UnwindSafe,
NonNull<MplsLabel>: UnwindSafe,
MplsLabel: UnwindSafe,
HashMap<NodeAttributeType, Vec<u8>>: UnwindSafe,
HashMap<LinkAttributeType, Vec<u8>>: UnwindSafe,
HashMap<PrefixAttributeType, Vec<u8>>: UnwindSafe,
*const u8: UnwindSafe,
Align8<*mut ()>: UnwindSafe,
&'static Vtable: UnwindSafe,
&'static str: UnwindSafe,
InternalBitFlags: UnwindSafe,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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