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§
Source§impl Default for MrtRibEncoder
impl Default for MrtRibEncoder
Source§fn default() -> MrtRibEncoder
fn default() -> MrtRibEncoder
Auto Trait Implementations§
impl Freeze for MrtRibEncoder
impl RefUnwindSafe for MrtRibEncoder
impl Send for MrtRibEncoder
impl Sync for MrtRibEncoder
impl Unpin for MrtRibEncoder
impl UnsafeUnpin for MrtRibEncoder
impl UnwindSafe for MrtRibEncoder
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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