pub struct ElemRef<'a> { /* private fields */ }Expand description
Borrowed view over a single BGP element inside a RecordElems batch.
Attributes are decoded lazily from attr_bytes when their accessors are called. The AS path and
community accessors do not allocate; next_hop() allocates for a dump entry whose next hop comes
from MP_REACH_NLRI, and materialising an element (to_bgp_elem) allocates, since the result
owns its AS path and communities.
Implementations§
Source§impl<'a> ElemRef<'a>
impl<'a> ElemRef<'a>
Sourcepub fn prefix(&self) -> NetworkPrefix
pub fn prefix(&self) -> NetworkPrefix
Returns the prefix this element announces, with the ADD-PATH identifier it carried.
Sourcepub fn peer_ip(&self) -> IpAddr
pub fn peer_ip(&self) -> IpAddr
Returns the IP address of the peer that exported this RIB entry.
Sourcepub fn as_path(&self) -> AsPathView<'a>
pub fn as_path(&self) -> AsPathView<'a>
Returns a zero-allocation borrowed view over the entry’s effective AS_PATH.
Sourcepub fn origin_asns(&self) -> AsnsView<'a>
pub fn origin_asns(&self) -> AsnsView<'a>
Returns a zero-allocation view over the originating ASNs of the effective AS_PATH.
Sourcepub fn communities(&self) -> CommunitiesView<'a>
pub fn communities(&self) -> CommunitiesView<'a>
Returns a zero-allocation view over the entry’s standard, extended, and large communities.
Sourcepub fn next_hop(&self) -> Option<IpAddr>
pub fn next_hop(&self) -> Option<IpAddr>
Returns the effective next-hop address (NEXT_HOP, or MP_REACH_NLRI’s global next hop).
An update’s elements read the address their record decoded once. A dump entry decodes
MP_REACH_NLRI here, through the owned NLRI parser, which allocates for the copied body and
the prefix list it validates.
Sourcepub fn med(&self) -> Option<u32>
pub fn med(&self) -> Option<u32>
Returns the Multi-Exit Discriminator (MULTI_EXIT_DISCRIMINATOR), matching
BgpElem::med (Some(0) on RIB announcements without MED).
Sourcepub fn local_pref(&self) -> Option<u32>
pub fn local_pref(&self) -> Option<u32>
Returns the Local Preference (LOCAL_PREFERENCE), matching
BgpElem::local_pref (Some(0) on RIB announcements without
LOCAL_PREFERENCE).
Sourcepub fn to_bgp_elem(&self) -> BgpElem
pub fn to_bgp_elem(&self) -> BgpElem
Materialise this entry as an owned BgpElem, for the fields the borrowed accessors do
not expose.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Freeze for ElemRef<'a>
impl<'a> !RefUnwindSafe for ElemRef<'a>
impl<'a> !Sync for ElemRef<'a>
impl<'a> Forget for ElemRef<'a>
impl<'a> Move for ElemRef<'a>
impl<'a> Send for ElemRef<'a>
impl<'a> Unpin for ElemRef<'a>
impl<'a> UnsafeUnpin for ElemRef<'a>where
&'a [u8]: UnsafeUnpin,
impl<'a> UnwindSafe for ElemRef<'a>where
&'a [u8]: 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
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<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> ⓘ
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> ⓘ
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