pub struct MrtRibEncoder { /* private fields */ }Implementations§
Source§impl MrtRibEncoder
impl MrtRibEncoder
pub fn new() -> Self
pub fn reset(&mut self)
Sourcepub fn process_elem(&mut self, elem: &BgpElem) -> Result<(), EncodingError>
pub fn process_elem(&mut self, elem: &BgpElem) -> Result<(), EncodingError>
Processes a BgpElem and updates the internal data structures.
Returns EncodingError::ValueTooLarge if the element’s peer would
exceed the 65535-peer capacity of the PEER_INDEX_TABLE; the encoder’s
state is left unchanged in that case.
§Arguments
elem- A reference to a BgpElem that contains the information to be processed.
Sourcepub fn export_bytes(&mut self) -> Result<Bytes, EncodingError>
pub fn export_bytes(&mut self) -> Result<Bytes, EncodingError>
Export the data stored in the struct to a byte array.
The function first encodes the peer-index-table data into a MrtMessage and appends it to the BytesMut object.
Then, for each prefix in the per_prefix_entries_map, it creates a RibAfiEntries object and encodes it as a MrtMessage.
The resulting BytesMut object is then converted to an immutable Bytes object using freeze() and returned.
§Return
Returns a Bytes object containing the exported data as a byte array,
or an EncodingError if any element cannot be represented in wire format.
Trait Implementations§
Auto Trait Implementations§
impl Forget for MrtRibEncoder
impl Freeze for MrtRibEncoderwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<(u16, Peer)>: Freeze,
PhantomData<(IpAddr, u16)>: Freeze,
PhantomData<(IpNet, HashMap<u16, RibEntry>)>: Freeze,
impl Move for MrtRibEncoder
impl RefUnwindSafe for MrtRibEncoderwhere
InternalBitFlags: RefUnwindSafe,
Asn: RefUnwindSafe,
AsPathSegment: RefUnwindSafe,
MplsLabel: RefUnwindSafe,
Atomic<*mut ()>: RefUnwindSafe,
InternalBitFlags: RefUnwindSafe,
impl Send for MrtRibEncoder
impl Sync for MrtRibEncoder
impl Unpin for MrtRibEncoderwhere
*const u8 is !null: Unpin,
InternalBitFlags: Unpin,
*const Asn is !null: Unpin,
Asn: Unpin,
*const AsPathSegment is !null: Unpin,
AsPathSegment: Unpin,
*const MplsLabel is !null: Unpin,
MplsLabel: Unpin,
*const u8: Unpin,
Align8<*mut ()>: Unpin,
&'static Vtable: Unpin,
InternalBitFlags: Unpin,
&'static str: Unpin,
impl UnsafeUnpin for MrtRibEncoderwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(u16, Peer)>: UnsafeUnpin,
PhantomData<(IpAddr, u16)>: UnsafeUnpin,
PhantomData<(IpNet, HashMap<u16, RibEntry>)>: UnsafeUnpin,
impl UnwindSafe for MrtRibEncoderwhere
RawVecInner: UnwindSafe,
HashMap<u16, Peer>: UnwindSafe,
HashMap<IpAddr, u16>: UnwindSafe,
HashMap<IpNet, HashMap<u16, RibEntry>>: 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> 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