### Quick Start: Establish BGP Session and Exchange Open Message Source: https://docs.rs/zettabgp/latest/zettabgp/index.html?search=std%3A%3Avec This example demonstrates how to connect to a BGP neighbor, configure session parameters, and exchange Open messages. It covers encoding and decoding BGP messages using the zettabgp library. ```rust use zettabgp::prelude::*; use std::io::{Read,Write}; let mut socket = match std::net::TcpStream::connect("127.0.0.1:179") { Ok(sck) => sck, Err(e) => {eprintln!("Unable to connect to BGP neighbor: {}",e);return;} }; let params=BgpSessionParams::new(64512,180,BgpTransportMode::IPv4,std::net::Ipv4Addr::new(1,1,1,1),vec![BgpCapability::SafiIPv4u].into_iter().collect()); let mut buf = [0 as u8; 32768]; let mut open_my = params.open_message(); let open_sz = open_my.encode_to(¶ms, &mut buf[19..]).unwrap(); let tosend = params.prepare_message_buf(&mut buf, BgpMessageType::Open, open_sz).unwrap(); socket.write_all(&buf[0..tosend]).unwrap();//send my open message socket.read_exact(&mut buf[0..19]).unwrap();//read response message head let messagehead=params.decode_message_head(&buf).unwrap();//decode message head if messagehead.0 == BgpMessageType::Open { socket.read_exact(&mut buf[0..messagehead.1]).unwrap();//read message body let mut bom = BgpOpenMessage::new(); bom.decode_from(¶ms, &buf[0..messagehead.1]).unwrap();//decode received message body eprintln!("BGP Open message received: {:?}", bom); } ``` -------------------------------- ### EVPNESI Search Examples Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/struct.EVPNESI.html?search= Examples of how to search for EVPNESI related information. These examples demonstrate common search patterns. ```APIDOC ## EVPNESI Search ### Description Provides examples of search queries for EVPNESI. ### Example Searches * `std::vec` * `u32 -> bool` * `Option, (T -> U) -> Option` ``` -------------------------------- ### MplsLabels Search Examples Source: https://docs.rs/zettabgp/latest/zettabgp/afi/struct.MplsLabels.html?search= Examples of how to search for MplsLabels. These demonstrate different query patterns. ```APIDOC ## Search MplsLabels ### Description Provides examples of search queries for MplsLabels. ### Example Searches - `std::vec` - `u32 -> bool` - `Option, (T -> U) -> Option` ``` -------------------------------- ### EVPNESI Implementations Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/struct.EVPNESI.html?search=u32+-%3E+bool Provides methods for creating, initializing, and checking EVPNESI instances. ```APIDOC ## impl EVPNESI ### `pub fn empty() -> EVPNESI` Creates an empty EVPNESI. ### `pub fn new(src: [u8; 9]) -> EVPNESI` Creates a new EVPNESI from a source byte array. ### `pub fn is_zero(&self) -> bool` Checks if the EVPNESI is all zeros. ### `pub fn read(buf: &[u8]) -> (u8, Self)` Reads an EVPNESI from a buffer, returning the number of bytes read and the EVPNESI instance. ``` -------------------------------- ### BgpL2::new Source: https://docs.rs/zettabgp/latest/zettabgp/afi/vpls/struct.BgpL2.html?search=std%3A%3Avec Constructor for creating a new BgpL2 instance. ```APIDOC ### impl BgpL2 #### pub fn new(srd: BgpRD, st: u16, ofs: u16, rng: u16) -> BgpL2 Creates a new BgpL2 instance with the provided parameters. ``` -------------------------------- ### EVPNESI Initialization and Utility Methods Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/struct.EVPNESI.html Provides methods to create an empty EVPNESI, initialize it with specific bytes, and check if it represents a zero value. ```rust pub fn empty() -> EVPNESI ``` ```rust pub fn new(src: [u8; 9]) -> EVPNESI ``` ```rust pub fn is_zero(&self) -> bool ``` -------------------------------- ### Get TypeId of BmpMessage Source: https://docs.rs/zettabgp/latest/zettabgp/bmp/enum.BmpMessage.html?search= Implements the Any trait for BmpMessage, providing a method to get the TypeId of the message. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### FSItem Trait Definition Source: https://docs.rs/zettabgp/latest/zettabgp/afi/flowspec/trait.FSItem.html This snippet shows the definition of the FSItem trait, which is a generic trait for FlowSpec NLRI items. It includes methods for decoding from a byte buffer, encoding to a byte buffer, getting the prefix length, and getting the storage size. ```APIDOC ## Trait FSItem ### Description FlowSpec NLRI item trait. ### Methods #### `decode_from_fs(buf: &[u8]) -> Result<(T, usize), BgpError>` Decodes an FSItem from a byte buffer. #### `encode_to_fs(&self, buf: &mut [u8]) -> Result<(), BgpError>` Encodes the FSItem to a byte buffer. #### `prefixlen(&self) -> usize` Returns the prefix length of the item. #### `get_store_size(&self) -> usize` Returns the storage size of the item. ``` -------------------------------- ### impl Any for T Source: https://docs.rs/zettabgp/latest/zettabgp/afi/ipv6/struct.BgpAddrV6.html Provides the `type_id` method to get the `TypeId` of the type. ```APIDOC ## fn type_id(&self) -> TypeId ### Description Gets the `TypeId` of `self`. ### Method fn type_id(&self) -> TypeId ``` -------------------------------- ### Constructing a BgpMdtV6 Prefix Source: https://docs.rs/zettabgp/latest/zettabgp/afi/mdt/struct.BgpMdtV6.html Demonstrates how to create a new BgpMdtV6 prefix using the `new` constructor. Ensure necessary types are imported. ```rust use zettabgp::prelude::{BgpAddrV6,BgpMdtV6}; use std::net::Ipv6Addr; let pfx = BgpMdtV6::new(BgpAddrV6::new(Ipv6Addr::new(0,0,0,0,0,0,0,1),128),Ipv6Addr::new(0xfe00,0,0,0,0,0,0,0)); ``` -------------------------------- ### BgpNextHop::new Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/nexthop/struct.BgpNextHop.html?search=u32+-%3E+bool Constructs a new BgpNextHop instance. ```APIDOC ## `new` - BgpNextHop Creates a new `BgpNextHop` with the given IP address. ### Signature ```rust pub fn new(v: IpAddr) -> BgpNextHop ``` ### Parameters * `v` (IpAddr) - The IP address for the nexthop. ``` -------------------------------- ### Get BgpRD Type Source: https://docs.rs/zettabgp/latest/zettabgp/afi/struct.BgpRD.html Returns the type of the Route Distinguisher as a u16. ```rust pub const fn rdtype(&self) -> u16 ``` -------------------------------- ### Get Encoded Number Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/extcommunity/struct.BgpExtCommunity.html?search= Extracts the encoded numerical value from a BgpExtCommunity object. ```rust pub fn get_num(&self) -> u16 ``` -------------------------------- ### BgpASset From for BgpASitem Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/struct.BgpASset.html Provides a conversion from BgpASset to BgpASitem. ```rust fn from(v: BgpASset) -> Self ``` -------------------------------- ### Get Administrator Assigned Number from BgpRD Source: https://docs.rs/zettabgp/latest/zettabgp/afi/struct.BgpRD.html Retrieves the administrator-assigned number from the BgpRD. ```rust pub fn aan(&self) -> Option ``` -------------------------------- ### BgpNextHop::new Constructor Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/nexthop/struct.BgpNextHop.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new BgpNextHop instance with the specified IP address. ```rust pub fn new(v: IpAddr) -> BgpNextHop ``` -------------------------------- ### Constructing a BgpMdtV4 Prefix Source: https://docs.rs/zettabgp/latest/zettabgp/afi/mdt/struct.BgpMdtV4.html Demonstrates how to create a new BgpMdtV4 prefix using the `new` associated function. Ensure necessary imports are included. ```rust use zettabgp::prelude::{BgpAddrV4,BgpMdtV4}; use std::net::Ipv4Addr; let pfx = BgpMdtV4::new(BgpAddrV4::new(Ipv4Addr::new(192,168,0,0),16),Ipv4Addr::new(224,0,0,0)); ``` -------------------------------- ### Get IPv4 Address from BgpRD Source: https://docs.rs/zettabgp/latest/zettabgp/afi/struct.BgpRD.html Retrieves the IPv4 address from the BgpRD if it is present. ```rust pub fn ipv4addr(&self) -> Option ``` -------------------------------- ### Get AS Number from BgpRD Source: https://docs.rs/zettabgp/latest/zettabgp/afi/struct.BgpRD.html Retrieves the Autonomous System (AS) number from the BgpRD if it is present. ```rust pub fn asn(&self) -> Option ``` -------------------------------- ### Get Encoded IPv4 Address Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/extcommunity/struct.BgpExtCommunity.html?search= Extracts the encoded IPv4 address from a BgpExtCommunity object. ```rust pub fn get_ipv4(&self) -> Ipv4Addr ``` -------------------------------- ### FSV4U::new Constructor Source: https://docs.rs/zettabgp/latest/zettabgp/afi/flowspec/struct.FSV4U.html?search= Provides a constructor for creating a new FSV4U instance. ```APIDOC ### impl FSV4U #### pub fn new(p: WithRd) -> FSV4U Creates a new FSV4U instance with the given prefix. ``` -------------------------------- ### decode_addr_from Source: https://docs.rs/zettabgp/latest/zettabgp/util/fn.decode_addr_from.html?search=std%3A%3Avec Gets an IPv4 or IPv6 address from the buffer. The address type is determined by the buffer length. ```APIDOC ## decode_addr_from ### Description Gets an IPv4 or IPv6 address from the buffer. Address type determined by buffer length. ### Signature `pub fn decode_addr_from(buf: &[u8]) -> Result` ### Parameters * `buf` (`&[u8]`) - A byte slice containing the address data. ### Returns * `Result` - Ok containing the `IpAddr` if successful, or an `Err` containing a `BgpError` if decoding fails. ``` -------------------------------- ### Create BgpLocalpref Instance Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/localpref/struct.BgpLocalpref.html Instantiates a new BgpLocalpref with a given unsigned 32-bit integer value. ```rust pub fn new(v: u32) -> BgpLocalpref ``` -------------------------------- ### BgpL2::new Constructor Source: https://docs.rs/zettabgp/latest/zettabgp/afi/vpls/struct.BgpL2.html Creates a new instance of BgpL2 with specified route distinguisher, site, offset, and range values. ```rust pub fn new(srd: BgpRD, st: u16, ofs: u16, rng: u16) -> BgpL2 ``` -------------------------------- ### decode_addr_from Source: https://docs.rs/zettabgp/latest/zettabgp/util/fn.decode_addr_from.html?search= Gets an IPv4 or IPv6 address from the buffer. The address type is determined by the buffer length. ```APIDOC ## decode_addr_from ### Description Gets an IPv4 or IPv6 address from the buffer. The address type is determined by the buffer length. ### Function Signature `pub fn decode_addr_from(buf: &[u8]) -> Result` ### Parameters #### Path Parameters - **buf** (`&[u8]`) - Description: A byte slice containing the address data. ### Return Value - `Result` - Returns `Ok(IpAddr)` if the address is successfully decoded, or `Err(BgpError)` if decoding fails. ``` -------------------------------- ### impl CloneToUninit for T Source: https://docs.rs/zettabgp/latest/zettabgp/afi/flowspec/struct.FS6.html This is a nightly-only experimental API for performing copy-assignment from self to a destination pointer. ```APIDOC ## unsafe fn clone_to_uninit(&self, dest: *mut u8) ### Description Performs copy-assignment from `self` to `dest`. ### Method `unsafe fn clone_to_uninit` ### Parameters - **self**: `&self` - The source object. - **dest**: `*mut u8` - A mutable pointer to the destination memory location. ``` -------------------------------- ### Any Trait Implementation for BgpKeepaliveMessage Source: https://docs.rs/zettabgp/latest/zettabgp/message/keepalive/struct.BgpKeepaliveMessage.html Implements the Any trait for BgpKeepaliveMessage, providing a way to get the TypeId of the struct. ```rust impl Any for T { fn type_id(&self) -> TypeId { // Gets the `TypeId` of `self`. unimplemented!() } } ``` -------------------------------- ### Get Minimum of Two BgpExtCommunity Values Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/extcommunity/struct.BgpExtCommunity.html?search=u32+-%3E+bool Compares two BgpExtCommunity values and returns the minimum. ```rust fn min(self, other: Self) -> Self where Self: Sized, ``` -------------------------------- ### BgpCommunityList::new() Constructor Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/community/struct.BgpCommunityList.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new, empty BgpCommunityList. ```rust pub fn new() -> BgpCommunityList ``` -------------------------------- ### BgpAddrs::new Source: https://docs.rs/zettabgp/latest/zettabgp/afi/enum.BgpAddrs.html?search= Creates a new, empty BgpAddrs instance. ```APIDOC ## BgpAddrs::new ### Description Creates a new empty BgpAddrs. ### Method ``` pub fn new() -> BgpAddrs ``` ``` -------------------------------- ### Get Maximum of Two BgpExtCommunity Values Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/extcommunity/struct.BgpExtCommunity.html?search=u32+-%3E+bool Compares two BgpExtCommunity values and returns the maximum. ```rust fn max(self, other: Self) -> Self where Self: Sized, ``` -------------------------------- ### BgpAddrs::new Source: https://docs.rs/zettabgp/latest/zettabgp/afi/enum.BgpAddrs.html?search=std%3A%3Avec Creates a new, empty BgpAddrs instance. ```APIDOC ## BgpAddrs::new ### Description Creates a new empty BgpAddrs. ### Signature `pub fn new() -> BgpAddrs` ``` -------------------------------- ### Getting the Last IP in a Subnet Source: https://docs.rs/zettabgp/latest/zettabgp/afi/ipv4/struct.BgpAddrV4.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves the last inclusive IP address within the subnet range. ```rust use std::net::Ipv4Addr; use zettabgp::prelude::BgpAddrV4; assert_eq!(BgpAddrV4::new(Ipv4Addr::new(192,168,120,130),16).range_last() , Ipv4Addr::new(192,168,255,255) ); ``` -------------------------------- ### Getting the First IP in a Subnet Source: https://docs.rs/zettabgp/latest/zettabgp/afi/ipv4/struct.BgpAddrV4.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves the network address, which is the first IP address within the subnet range. ```rust use std::net::Ipv4Addr; use zettabgp::prelude::BgpAddrV4; assert_eq!(BgpAddrV4::new(Ipv4Addr::new(192,168,120,130),16).range_first() , Ipv4Addr::new(192,168,0,0) ); ``` -------------------------------- ### Create a new BgpNet instance Source: https://docs.rs/zettabgp/latest/zettabgp/afi/enum.BgpNet.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Constructs a new BgpNet instance from an IP address and prefix length. Ensure the input IP address and prefix length are valid. ```rust pub fn new(addr: IpAddr, prefixlen: u8) -> BgpNet ``` -------------------------------- ### Generic CloneToUninit Implementation (Nightly) Source: https://docs.rs/zettabgp/latest/zettabgp/bmp/prelude/struct.BmpMessageInitiation.html?search= An experimental nightly-only API for copying data to uninitialized memory. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### FS6 FSItem Prefix Length and Size Source: https://docs.rs/zettabgp/latest/zettabgp/afi/flowspec/struct.FS6.html?search=std%3A%3Avec Methods to get the prefix length and storage size of an FS6 item. ```rust fn prefixlen(&self) -> usize ``` ```rust fn get_store_size(&self) -> usize ``` -------------------------------- ### decode_addrv6_from Source: https://docs.rs/zettabgp/latest/zettabgp/util/fn.decode_addrv6_from.html?search= Gets an IPv6 address from the provided byte buffer. It returns a Result containing either the decoded Ipv6Addr or a BgpError. ```APIDOC ## Function decode_addrv6_from ### Description Gets ipv6 address from the buffer. ### Signature ```rust pub fn decode_addrv6_from(buf: &[u8]) -> Result ``` ### Parameters * `buf` - A byte slice (`&[u8]`) from which to decode the IPv6 address. ### Returns A `Result` which is either: * `Ok(Ipv6Addr)`: If the IPv6 address is successfully decoded. * `Err(BgpError)`: If an error occurs during decoding. ``` -------------------------------- ### BgpConnector::new Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/connector/struct.BgpConnector.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Constructs a new BgpConnector instance. ```APIDOC ## `new` Function ### Description Creates a new `BgpConnector` with the specified ASN, address, and origin address. ### Signature `pub fn new(asn: u32, addr: Ipv4Addr, orig: Ipv4Addr) -> BgpConnector` ``` -------------------------------- ### Importing the BMP Prelude Source: https://docs.rs/zettabgp/latest/zettabgp/bmp/prelude/index.html Use this statement to import all common items from the zettabgp BMP prelude module. ```rust use zettabgp::bmp::prelude::*; ``` -------------------------------- ### decode_addrv4_from Source: https://docs.rs/zettabgp/latest/zettabgp/util/fn.decode_addrv4_from.html?search=u32+-%3E+bool Gets an IPv4 address from the provided byte buffer. It returns a Result containing either the decoded Ipv4Addr or a BgpError. ```APIDOC ## Function decode_addrv4_from ### Description Gets ipv4 address from the buffer. ### Signature ```rust pub fn decode_addrv4_from(buf: &[u8]) -> Result ``` ### Parameters * `buf` - A byte slice (`&[u8]`) from which to decode the IPv4 address. ### Returns A `Result` which is either: * `Ok(Ipv4Addr)`: If the IPv4 address is successfully decoded. * `Err(BgpError)`: If an error occurs during decoding. ``` -------------------------------- ### decode_addrv4_from Source: https://docs.rs/zettabgp/latest/zettabgp/util/fn.decode_addrv4_from.html?search= Gets an IPv4 address from the provided byte buffer. It returns a Result containing either the decoded Ipv4Addr or a BgpError. ```APIDOC ## Function decode_addrv4_from ### Description Gets an IPv4 address from the buffer. ### Signature ```rust pub fn decode_addrv4_from(buf: &[u8]) -> Result ``` ### Parameters * `buf` (&[u8]): A slice of bytes from which to decode the IPv4 address. ``` -------------------------------- ### impl CloneToUninit for T Source: https://docs.rs/zettabgp/latest/zettabgp/afi/ipv6/struct.BgpAddrV6.html Provides the `clone_to_uninit` method for nightly-only experimental cloning to uninitialized memory. ```APIDOC ## unsafe fn clone_to_uninit(&self, dest: *mut u8) ### Description 🔬This is a nightly-only experimental API. (`clone_to_uninit`) Performs copy-assignment from `self` to `dest`. ### Method unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### FS6 Get Store Size Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/afi/flowspec/struct.FS6.html?search= Implements the get_store_size method for FS6, returning the storage size of the FS6 instance. ```rust fn get_store_size(&self) -> usize ``` -------------------------------- ### BgpCommunity Constructor: new Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/community/struct.BgpCommunity.html?search=std%3A%3Avec Creates a new BgpCommunity instance with a given u32 value. ```rust pub fn new(v: u32) -> BgpCommunity ``` -------------------------------- ### Get Minimum of two BgpEVPN Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/enum.BgpEVPN.html?search= Returns the minimum of two BgpEVPN values. This is a convenience method provided by the Ord trait. ```rust fn min(self, other: Self) -> Self where Self: Sized, ``` -------------------------------- ### Implement CloneToUninit for T Source: https://docs.rs/zettabgp/latest/zettabgp/enum.BgpTransportMode.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Nightly-only experimental API for cloning data into uninitialized memory. ```rust impl where T: Clone, ``` -------------------------------- ### BgpExtCommunityList::new() Constructor Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/extcommunity/struct.BgpExtCommunityList.html Creates a new, empty BgpExtCommunityList. Use this when initializing a new attribute. ```rust pub fn new() -> BgpExtCommunityList ``` -------------------------------- ### Get Maximum of two BgpEVPN Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/enum.BgpEVPN.html?search= Returns the maximum of two BgpEVPN values. This is a convenience method provided by the Ord trait. ```rust fn max(self, other: Self) -> Self where Self: Sized, ``` -------------------------------- ### BgpAttr Trait Implementation for BgpMPUpdates Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/multiproto/struct.BgpMPUpdates.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implements the BgpAttr trait for BgpMPUpdates, providing methods to get attribute information and encode to a buffer. ```rust fn attr(&self) -> BgpAttrParams ``` ```rust fn encode_to( &self, peer: &BgpSessionParams, buf: &mut [u8], ) -> Result ``` -------------------------------- ### BgpASseq From for BgpASitem Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/struct.BgpASseq.html?search=std%3A%3Avec Converts a BgpASseq into a BgpASitem. ```rust fn from(v: BgpASseq) -> Self ``` -------------------------------- ### BgpLargeCommunityList::new() Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/community/struct.BgpLargeCommunityList.html Creates a new, empty BgpLargeCommunityList. This is the default constructor. ```rust pub fn new() -> BgpLargeCommunityList ``` -------------------------------- ### BgpAttr Trait Implementation for BgpAtomicAggregate Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/atomicaggregate/struct.BgpAtomicAggregate.html Implements the BgpAttr trait for BgpAtomicAggregate, providing methods to get attribute parameters and encode to a buffer. ```rust fn attr(&self) -> BgpAttrParams ``` ```rust fn encode_to( &self, _peer: &BgpSessionParams, buf: &mut [u8], ) -> Result ``` -------------------------------- ### PartialEq Implementation for BgpPMSITaMLDP Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/pmsitunnelattr/struct.BgpPMSITaMLDP.html?search=u32+-%3E+bool Implements equality comparison for BgpPMSITaMLDP instances using `eq` and `ne`. ```rust fn eq(&self, other: &BgpPMSITaMLDP) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### BgpItem Trait Implementation for MplsLabels Source: https://docs.rs/zettabgp/latest/zettabgp/afi/struct.MplsLabels.html?search= Implements methods for extracting bits from a buffer, setting bits in a buffer, and getting the prefix length for MplsLabels. ```rust fn extract_bits_from( bits: u8, buf: &[u8], ) -> Result<(MplsLabels, usize), BgpError> ``` ```rust fn set_bits_to(&self, buf: &mut [u8]) -> Result<(u8, usize), BgpError> ``` ```rust fn prefixlen(&self) -> usize ``` -------------------------------- ### Get the first MacAddress in a BgpAddrMac subnet Source: https://docs.rs/zettabgp/latest/zettabgp/afi/mac/struct.BgpAddrMac.html Retrieves the network address (first MAC address) of the subnet. Requires MacAddress and BgpAddrMac to be imported. ```rust use zettabgp::afi::mac::MacAddress; use zettabgp::prelude::BgpAddrMac; assert_eq!(BgpAddrMac::new(MacAddress::from_u64(0x1213141516ab),40).range_first() , MacAddress::from_u64(0x121314151600) ); ``` -------------------------------- ### MacAddress::partial_cmp() Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/afi/mac/struct.MacAddress.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Compares two MacAddress values and returns an Option if an ordering exists. ```rust fn partial_cmp(&self, other: &MacAddress) -> Option ``` -------------------------------- ### FSOperMaskItem FSOperItem Implementations Source: https://docs.rs/zettabgp/latest/zettabgp/afi/flowspec/struct.FSOperMaskItem.html?search=std%3A%3Avec Provides implementations for the FSOperItem trait, including methods for getting byte length, encoding to a buffer, and decoding from a buffer. ```rust fn getbyteslen(&self) -> usize ``` ```rust fn encode_to(&self, buf: &mut [u8]) -> Result ``` ```rust fn decode_from(buf: &[u8]) -> Result<(Self, usize), BgpError> ``` -------------------------------- ### BgpOriginatorID Implementations Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/originatorid/struct.BgpOriginatorID.html?search=u32+-%3E+bool Provides methods for creating, decoding, and interacting with BgpOriginatorID instances. ```APIDOC ## Implementations for BgpOriginatorID ### Constructor * `new(o: IpAddr) -> BgpOriginatorID`: Creates a new BgpOriginatorID with the given IP address. ### Decoding * `decode_from(peer: &BgpSessionParams, buf: &[u8]) -> Result`: Decodes a BgpOriginatorID from a byte buffer. ### Trait Implementations * `BgpAttr`: Provides methods for attribute handling (`attr`, `encode_to`). * `Clone`: Allows cloning BgpOriginatorID instances. * `Debug`: Enables debugging output. * `Deserialize`: Supports deserialization from Serde. * `Display`: Allows formatting BgpOriginatorID as a string. * `Eq`, `PartialEq`: Enables equality comparisons. * `Hash`: Supports hashing BgpOriginatorID instances. * `Ord`, `PartialOrd`: Enables ordering comparisons. ``` -------------------------------- ### slice_mut Source: https://docs.rs/zettabgp/latest/zettabgp/util/fn.slice_mut.html Safely creates a mutable slice from a buffer. It returns a `BgpError::InsufficientBufferSize` if the specified start and end indices are out of bounds for the given buffer. ```APIDOC ## slice_mut ### Description Returns `BgpError::InsufficientBufferSize` if slicing is out of bounds. ### Signature ```rust pub fn slice_mut(buf: &mut [T], start: usize, end: usize) -> Result<&mut [T], BgpError> ``` ### Parameters * `buf` - A mutable slice of type `T` to be sliced. * `start` - The starting index of the slice (inclusive). * `end` - The ending index of the slice (exclusive). ### Returns - `Ok(&mut [T])` - A mutable slice of the buffer if the indices are valid. - `Err(BgpError)` - `BgpError::InsufficientBufferSize` if `start` or `end` are out of bounds. ``` -------------------------------- ### BgpASset Ord Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/struct.BgpASset.html Defines the total ordering for BgpASset instances. ```rust fn cmp(&self, other: &BgpASset) -> Ordering ``` -------------------------------- ### BgpAttr Trait Implementation for BgpMPUpdates Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/multiproto/struct.BgpMPUpdates.html?search=std%3A%3Avec Provides implementations for the BgpAttr trait for the BgpMPUpdates struct, including methods to get attribute parameters and encode to a buffer. ```rust fn attr(&self) -> BgpAttrParams ``` ```rust fn encode_to( &self, peer: &BgpSessionParams, buf: &mut [u8], ) -> Result ``` -------------------------------- ### BgpASset Ord Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/struct.BgpASset.html?search= Defines ordering comparisons for BgpASset. ```rust fn cmp(&self, other: &BgpASset) -> Ordering ``` ```rust fn max(self, other: Self) -> Self where Self: Sized ``` ```rust fn min(self, other: Self) -> Self where Self: Sized ``` ```rust fn clamp(self, min: Self, max: Self) -> Self where Self: Sized ``` -------------------------------- ### BgpASitem Serialize Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/enum.BgpASitem.html?search=u32+-%3E+bool Allows serialization of a BgpASitem into a Serde serializer. This is essential for constructing BGP messages that include AS path information. ```rust impl Serialize for BgpASitem { fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where __S: Serializer, { // Implementation details omitted for brevity } } ``` -------------------------------- ### Get the last MacAddress in a BgpAddrMac subnet Source: https://docs.rs/zettabgp/latest/zettabgp/afi/mac/struct.BgpAddrMac.html Returns the last inclusive MAC address within the defined subnet. Ensure MacAddress and BgpAddrMac are imported. ```rust use zettabgp::afi::mac::MacAddress; use zettabgp::prelude::BgpAddrMac; assert_eq!(BgpAddrMac::new(MacAddress::from_u64(0x1213141516ab),40).range_last() , MacAddress::from_u64(0x1213141516ff)); ``` -------------------------------- ### slice_mut Source: https://docs.rs/zettabgp/latest/zettabgp/util/fn.slice_mut.html?search=std%3A%3Avec Provides a mutable slice of a given buffer within specified start and end indices. Returns BgpError::InsufficientBufferSize if the slicing operation is out of bounds. ```APIDOC ## Function slice_mut ### Description Returns BgpError::InsufficientBufferSize if slicing is out of bounds. ### Signature ```rust pub fn slice_mut(buf: &mut [T], start: usize, end: usize) -> Result<&mut [T], BgpError> ``` ### Parameters * `buf`: A mutable slice of type `T` to be sliced. * `start`: The starting index of the slice (inclusive). * `end`: The ending index of the slice (exclusive). ### Returns - `Ok(&mut [T])`: A mutable slice of the buffer if the slicing is successful. - `Err(BgpError)`: Returns `BgpError::InsufficientBufferSize` if `start` or `end` are out of bounds. ``` -------------------------------- ### BgpOriginatorID::new Constructor Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/originatorid/struct.BgpOriginatorID.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new BgpOriginatorID instance with the provided IP address. ```rust pub fn new(o: IpAddr) -> BgpOriginatorID ``` -------------------------------- ### min Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/struct.BgpEVPN4.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Compares two BgpEVPN4 instances and returns the minimum value. ```APIDOC ## fn min ```rust fn min(self, other: Self) -> Self ``` ### Description Compares and returns the minimum of two values. ``` -------------------------------- ### slice Function Source: https://docs.rs/zettabgp/latest/zettabgp/util/fn.slice.html The slice function returns a slice of a buffer if the start and end indices are within bounds. It returns BgpError::InsufficientBufferSize if slicing is out of bounds. ```APIDOC ## slice ### Description Returns a slice of a buffer if the start and end indices are within bounds. It returns BgpError::InsufficientBufferSize if slicing is out of bounds. ### Function Signature ```rust pub fn slice(buf: &[T], start: usize, end: usize) -> Result<&[T], BgpError> ``` ### Parameters * `buf` (&[T]): The input buffer to slice. * `start` (usize): The starting index of the slice. * `end` (usize): The ending index of the slice. ### Returns * `Result<&[T], BgpError>`: A `Result` containing a slice of the buffer on success, or a `BgpError` if the slicing is out of bounds. ``` -------------------------------- ### Partial Compare BgpOrigin Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/origin/struct.BgpOrigin.html Returns an Option between two BgpOrigin values if an ordering exists. ```rust fn partial_cmp(&self, other: &BgpOrigin) -> Option ``` -------------------------------- ### slice_mut Function Signature Source: https://docs.rs/zettabgp/latest/zettabgp/util/fn.slice_mut.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Defines the signature for the slice_mut function, which takes a mutable slice, start and end indices, and returns a mutable slice or a BgpError. ```rust pub fn slice_mut< T >( buf: &mut [T], start: usize, end: usize, ) -> Result<&mut [T], BgpError> ``` -------------------------------- ### BgpASset PartialEq Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/struct.BgpASset.html?search= Defines equality comparisons for BgpASset. ```rust fn eq(&self, other: &BgpASset) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### slice_mut Function Signature Source: https://docs.rs/zettabgp/latest/zettabgp/util/fn.slice_mut.html?search= This is the function signature for slice_mut. It takes a mutable slice, start and end indices, and returns a Result containing a mutable slice or a BgpError. ```rust pub fn slice_mut< T, >(buf: &mut [T], start: usize, end: usize) -> Result<&mut [T], BgpError> ``` -------------------------------- ### FSOperItem Trait Definition Source: https://docs.rs/zettabgp/latest/zettabgp/afi/flowspec/trait.FSOperItem.html Defines the core methods required for FlowSpec operation items: getting byte length, encoding to a buffer, and decoding from a buffer. This trait requires the item to be cloneable and comparable. ```rust pub trait FSOperItem: Clone + PartialEq + Eq + PartialOrd + Ord { // Required methods fn getbyteslen(&self) -> usize; fn encode_to(&self, buf: &mut [u8]) -> Result; fn decode_from(buf: &[u8]) -> Result<(Self, usize), BgpError>; } ``` -------------------------------- ### MacAddress PartialOrd Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/afi/mac/struct.MacAddress.html?search=std%3A%3Avec Provides partial ordering for MacAddress instances, enabling comparisons like `<`, `<=`, `>`, and `>=`. Returns `None` if comparison is not possible. ```rust fn partial_cmp(&self, other: &MacAddress) -> Option ``` ```rust fn lt(&self, other: &Rhs) -> bool ``` ```rust fn le(&self, other: &Rhs) -> bool ``` ```rust fn gt(&self, other: &Rhs) -> bool ``` ```rust fn ge(&self, other: &Rhs) -> bool ``` -------------------------------- ### FS6::new Constructor Source: https://docs.rs/zettabgp/latest/zettabgp/afi/flowspec/struct.FS6.html?search=u32+-%3E+bool Creates a new instance of the FS6 struct. ```APIDOC ### impl FS6 #### pub fn new(ofs: u8, v6: BgpAddrV6) -> FS6 Constructs a new FS6 with the given offset and IPv6 address. ``` -------------------------------- ### Getting the last IP address in a BgpAddrV6 subnet range Source: https://docs.rs/zettabgp/latest/zettabgp/afi/ipv6/struct.BgpAddrV6.html?search= Retrieves the last inclusive IP address within the subnet range defined by the BgpAddrV6 instance. Asserts equality with the expected last IP. ```rust use std::net::Ipv6Addr; use zettabgp::prelude::BgpAddrV6; assert_eq!(BgpAddrV6::new(Ipv6Addr::new(0x2a02,0,0,0,0,0,0,0x100),112).range_last() , Ipv6Addr::new(0x2a02,0,0,0,0,0,0,0xffff) ); ``` -------------------------------- ### BgpASset PartialOrd Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/struct.BgpASset.html Defines partial ordering for BgpASset instances. ```rust fn partial_cmp(&self, other: &BgpASset) -> Option ``` -------------------------------- ### Getting the first IP address in a BgpAddrV6 subnet range Source: https://docs.rs/zettabgp/latest/zettabgp/afi/ipv6/struct.BgpAddrV6.html?search= Retrieves the network address, which is the first IP address within the subnet range defined by the BgpAddrV6 instance. Asserts equality with the expected first IP. ```rust use std::net::Ipv6Addr; use zettabgp::prelude::BgpAddrV6; assert_eq!(BgpAddrV6::new(Ipv6Addr::new(0x2a02,0,0,0,0,0,0,0x100),32).range_first() , Ipv6Addr::new(0x2a02,0,0,0,0,0,0,0) ); ``` -------------------------------- ### BGP Origin Constructor Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/origin/struct.BgpOrigin.html Creates a new BgpOrigin instance with a given BgpAttrOrigin value. ```rust pub fn new(v: BgpAttrOrigin) -> BgpOrigin ``` -------------------------------- ### Clone Implementation for BgpPMSITaMLDP Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/pmsitunnelattr/struct.BgpPMSITaMLDP.html?search=u32+-%3E+bool Provides the `clone` method to create a duplicate of a BgpPMSITaMLDP instance. ```rust fn clone(&self) -> BgpPMSITaMLDP ``` -------------------------------- ### BgpOrigin::new Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/origin/struct.BgpOrigin.html Constructs a new `BgpOrigin` instance with the provided origin value. ```APIDOC ## `BgpOrigin::new` ### Description Creates a new `BgpOrigin` with the given `BgpAttrOrigin` value. ### Signature `pub fn new(v: BgpAttrOrigin) -> BgpOrigin` ``` -------------------------------- ### BgpL2::partial_cmp Method Source: https://docs.rs/zettabgp/latest/zettabgp/afi/vpls/struct.BgpL2.html Compares two BgpL2 values and returns an Option if a comparison is possible. ```rust fn partial_cmp(&self, other: &BgpL2) -> Option ``` -------------------------------- ### EVPNESI Implementations Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/struct.EVPNESI.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Details the various trait implementations for the EVPNESI struct, including Clone, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd, and Serialize. ```APIDOC ## EVPNESI Trait Implementations ### Clone * `fn clone(&self) -> EVPNESI`: Returns a duplicate of the value. * `fn clone_from(&mut self, source: &Self)`: Performs copy-assignment from `source`. ### Debug * `fn fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### Deserialize * `fn deserialize<__D>(__deserializer: __D) -> Result`: Deserializes this value from the given Serde deserializer. ### Display * `fn fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### Eq * Implements equality comparison for EVPNESI. ### Hash * `fn hash<__H: Hasher>(&self, state: &mut __H)`: Feeds this value into the given `Hasher`. * `fn hash_slice(data: &[Self], state: &mut H)`: Feeds a slice of this type into the given `Hasher`. ### Ord * `fn cmp(&self, other: &EVPNESI) -> Ordering`: Compares `self` and `other`. * `fn max(self, other: Self) -> Self`: Returns the maximum of two values. * `fn min(self, other: Self) -> Self`: Returns the minimum of two values. * `fn clamp(self, min: Self, max: Self) -> Self`: Restricts a value to a certain interval. ### PartialEq * `fn eq(&self, other: &EVPNESI) -> bool`: Tests for equality. * `fn ne(&self, other: &Rhs) -> bool`: Tests for inequality. ### PartialOrd * `fn partial_cmp(&self, other: &EVPNESI) -> Option`: Returns an ordering between `self` and `other` if one exists. * `fn lt(&self, other: &Rhs) -> bool`: Tests less than. * `fn le(&self, other: &Rhs) -> bool`: Tests less than or equal to. * `fn gt(&self, other: &Rhs) -> bool`: Tests greater than. * `fn ge(&self, other: &Rhs) -> bool`: Tests greater than or equal to. ### Serialize * `fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>`: Serializes this value into the given Serde serializer. ### StructuralPartialEq * Implements structural partial equality comparison for EVPNESI. ``` -------------------------------- ### BgpConnector::new Constructor Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/connector/struct.BgpConnector.html Creates a new BgpConnector instance with the provided ASN and IP addresses. ```rust pub fn new(asn: u32, addr: Ipv4Addr, orig: Ipv4Addr) -> BgpConnector ``` -------------------------------- ### BgpASset PartialEq Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/struct.BgpASset.html Tests for equality between two BgpASset instances. ```rust fn eq(&self, other: &BgpASset) -> bool ``` -------------------------------- ### BmpMessageInitiation new() function Source: https://docs.rs/zettabgp/latest/zettabgp/bmp/prelude/struct.BmpMessageInitiation.html Creates a new instance of BmpMessageInitiation. ```rust pub fn new() -> BmpMessageInitiation ``` -------------------------------- ### BgpAddrs Implementation Methods Source: https://docs.rs/zettabgp/latest/zettabgp/afi/enum.BgpAddrs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides methods for creating, inspecting, and processing BgpAddrs collections, including initialization, emptiness checks, length retrieval, AFI/SAFI code retrieval, and decoding/encoding from byte buffers. ```APIDOC ## BgpAddrs Implementation Methods ### `new()` Creates a new, empty `BgpAddrs` instance. ### `is_empty(&self) -> bool` Checks if the `BgpAddrs` collection is empty. ### `len(&self) -> usize` Returns the number of elements in the `BgpAddrs` collection. ### `get_afi_safi(&self) -> (u16, u8)` Retrieves the BGP AFI (Address Family Identifier) and SAFI (Subsequent Address Family Identifier) codes associated with the addresses. ### `decode_from(peer: &BgpSessionParams, afi: u16, safi: u8, buf: &[u8]) -> Result<(BgpAddrs, usize), BgpError>` Decodes `BgpAddrs` from a byte buffer, given the BGP session parameters, AFI, and SAFI. ### `encode_to(&self, peer: &BgpSessionParams, buf: &mut [u8]) -> Result` Encodes the `BgpAddrs` instance into a byte buffer for a given BGP session. ``` -------------------------------- ### partial_cmp Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/struct.BgpEVPN4.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Compares two BgpEVPN4 instances and returns an Option if an ordering exists. ```APIDOC ## fn partial_cmp ```rust fn partial_cmp(&self, other: &BgpEVPN4) -> Option ``` ### Description This method returns an ordering between `self` and `other` values if one exists. ``` -------------------------------- ### BgpASset Ord Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/struct.BgpASset.html?search=std%3A%3Avec Provides total ordering for BgpASset instances, enabling comparisons and use in ordered collections like BTreeSet. ```rust fn cmp(&self, other: &BgpASset) -> Ordering ``` ```rust fn max(self, other: Self) -> Self where Self: Sized, ``` ```rust fn min(self, other: Self) -> Self where Self: Sized, ``` ```rust fn clamp(self, min: Self, max: Self) -> Self where Self: Sized, ``` -------------------------------- ### Serialize Implementation for BgpPMSITaMLDP Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/pmsitunnelattr/struct.BgpPMSITaMLDP.html Enables serialization of BgpPMSITaMLDP to a Serde serializer. ```rust fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where __S: Serializer, Serialize this value into the given Serde serializer. Read more ``` -------------------------------- ### BgpASitem Ord Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/enum.BgpASitem.html?search=u32+-%3E+bool Provides total ordering for BgpASitem, enabling comparisons between different AS path items. ```rust impl Ord for BgpASitem { fn cmp(&self, other: &BgpASitem) -> Ordering { // Implementation details omitted for brevity } fn max(self, other: Self) -> Self where Self: Sized, { // Implementation details omitted for brevity } fn min(self, other: Self) -> Self where Self: Sized, { // Implementation details omitted for brevity } fn clamp(self, min: Self, max: Self) -> Self where Self: Sized, { // Implementation details omitted for brevity } } ``` -------------------------------- ### BgpEVPN5 Ord Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/struct.BgpEVPN5.html?search=std%3A%3Avec Provides methods for ordering BgpEVPN5 instances, including comparison, finding maximum/minimum, and clamping values within a range. ```rust fn cmp(&self, other: &BgpEVPN5) -> Ordering ``` ```rust fn max(self, other: Self) -> Self where Self: Sized, ``` ```rust fn min(self, other: Self) -> Self where Self: Sized, ``` ```rust fn clamp(self, min: Self, max: Self) -> Self where Self: Sized, ``` -------------------------------- ### BgpASset Ord Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/struct.BgpASset.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides methods for ordering BgpASset values. ```rust fn cmp(&self, other: &BgpASset) -> Ordering ``` ```rust fn max(self, other: Self) -> Self where Self: Sized, ``` ```rust fn min(self, other: Self) -> Self where Self: Sized, ``` ```rust fn clamp(self, min: Self, max: Self) -> Self ``` -------------------------------- ### BgpASitem PartialEq Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/aspath/enum.BgpASitem.html?search=u32+-%3E+bool Defines equality comparison for BgpASitem, allowing checks for whether two AS path items are identical. ```rust impl PartialEq for BgpASitem { fn eq(&self, other: &BgpASitem) -> bool { // Implementation details omitted for brevity } fn ne(&self, other: &Rhs) -> bool { // Implementation details omitted for brevity } } ``` -------------------------------- ### Ord Implementation for BgpPMSITaMLDP Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/pmsitunnelattr/struct.BgpPMSITaMLDP.html?search=u32+-%3E+bool Provides comparison methods for BgpPMSITaMLDP, including `cmp`, `max`, `min`, and `clamp`. ```rust fn cmp(&self, other: &BgpPMSITaMLDP) -> Ordering ``` ```rust fn max(self, other: Self) -> Self where Self: Sized, ``` ```rust fn min(self, other: Self) -> Self where Self: Sized, ``` ```rust fn clamp(self, min: Self, max: Self) -> Self where Self: Sized, ``` -------------------------------- ### Construct MacAddress from u64 Source: https://docs.rs/zettabgp/latest/zettabgp/afi/mac/struct.MacAddress.html Creates a new MacAddress by packing a 64-bit unsigned integer into the six MAC address bytes. Assumes the relevant lower 48 bits of the u64 are used. ```rust pub fn from_u64(s: u64) -> MacAddress ``` -------------------------------- ### Import zettabgp Prelude Source: https://docs.rs/zettabgp/latest/zettabgp/prelude/index.html Use this statement to import all common members re-exported by the prelude module. This simplifies the process of using frequently needed items from the zettabgp library. ```rust use zettabgp::prelude::*; ``` -------------------------------- ### PartialEq Implementation for BgpEVPN Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/enum.BgpEVPN.html?search=u32+-%3E+bool Provides partial equality comparison for BgpEVPN instances. ```APIDOC ## impl PartialEq for BgpEVPN ### eq ```rust fn eq(&self, other: &BgpEVPN) -> bool ``` Tests for `self` and `other` values to be equal, and is used by `==`. ``` ```APIDOC ### ne ```rust fn ne(&self, other: &Rhs) -> bool ``` Tests for `!=`. ``` -------------------------------- ### BgpCommunityList::new Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/community/struct.BgpCommunityList.html?search= Constructs a new, empty BgpCommunityList. ```APIDOC ## BgpCommunityList::new ### Description Constructs a new, empty BgpCommunityList. ### Method `new()` ### Returns - `BgpCommunityList`: An empty community list. ``` -------------------------------- ### MacAddress::cmp() Implementation Source: https://docs.rs/zettabgp/latest/zettabgp/afi/mac/struct.MacAddress.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Compares two MacAddress values and returns an Ordering. ```rust fn cmp(&self, other: &MacAddress) -> Ordering ``` -------------------------------- ### Compare BgpIPv4RD Source: https://docs.rs/zettabgp/latest/zettabgp/afi/ipv4/struct.BgpIPv4RD.html?search=u32+-%3E+bool Compares two BgpIPv4RD instances and returns an Ordering. ```rust fn cmp(&self, other: &BgpIPv4RD) -> Ordering ``` -------------------------------- ### Display Implementation for BgpPMSITaRSVP Source: https://docs.rs/zettabgp/latest/zettabgp/message/attributes/pmsitunnelattr/struct.BgpPMSITaRSVP.html?search= Enables formatted string representation for BgpPMSITaRSVP instances. ```rust impl Display for BgpPMSITaRSVP fn fmt(&self, f: &mut Formatter<'_>) -> Result ``` -------------------------------- ### Partial Compare BgpIPv4RD Source: https://docs.rs/zettabgp/latest/zettabgp/afi/ipv4/struct.BgpIPv4RD.html?search=u32+-%3E+bool Compares two BgpIPv4RD instances and returns an Option if a comparison is possible. ```rust fn partial_cmp(&self, other: &BgpIPv4RD) -> Option ``` -------------------------------- ### MplsLabels::new Source: https://docs.rs/zettabgp/latest/zettabgp/afi/struct.MplsLabels.html?search=u32+-%3E+bool Creates a new, empty MPLS label stack. ```APIDOC ## `new()` Creates a new empty label stack. ### Returns * `MplsLabels` - A new empty MplsLabels instance. ``` -------------------------------- ### BgpEVPN3 partial_cmp Source: https://docs.rs/zettabgp/latest/zettabgp/afi/evpn/struct.BgpEVPN3.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Compares two BgpEVPN3 instances and returns an Option if a comparison is possible. ```APIDOC ## fn partial_cmp ### Description This method returns an ordering between `self` and `other` values if one exists. ### Signature `fn partial_cmp(&self, other: &BgpEVPN3) -> Option` ```