Struct bgpkit_parser::encoder::MrtRibEncoder
source · 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)
pub fn process_elem(&mut self, elem: &BgpElem)
Processes a BgpElem and updates the internal data structures.
§Arguments
elem
- A reference to a BgpElem that contains the information to be processed.
sourcepub fn export_bytes(&mut self) -> Bytes
pub fn export_bytes(&mut self) -> Bytes
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.
Trait Implementations§
source§impl Default for MrtRibEncoder
impl Default for MrtRibEncoder
source§fn default() -> MrtRibEncoder
fn default() -> MrtRibEncoder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MrtRibEncoder
impl RefUnwindSafe for MrtRibEncoder
impl Send for MrtRibEncoder
impl Sync for MrtRibEncoder
impl Unpin 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
Mutably borrows from an owned value. Read more