Enum bgpkit_parser::models::elem::ElemType
source · pub enum ElemType {
ANNOUNCE,
WITHDRAW,
}
Expand description
§ElemType
ElemType
is an enumeration that represents the type of an element.
It has two possible values:
ANNOUNCE
: Indicates an announcement/reachable prefix.WITHDRAW
: Indicates a withdrawn/unreachable prefix.
The enumeration derives the traits Debug
, Clone
, Copy
, PartialEq
, Eq
, and Hash
.
It also has the following attributes:
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
- This attribute is conditionally applied when the
"serde"
feature is enabled. It allows the enumeration to be serialized and deserialized using serde.
- This attribute is conditionally applied when the
#[cfg_attr(feature = "serde", serde(rename = "lowercase"))]
- This attribute is conditionally applied when the
"serde"
feature is enabled. It specifies that the serialized form of the enumeration should be in lowercase.
- This attribute is conditionally applied when the
Example usage:
use bgpkit_parser::models::ElemType;
let announce_type = ElemType::ANNOUNCE;
let withdraw_type = ElemType::WITHDRAW;
assert_eq!(announce_type, ElemType::ANNOUNCE);
assert_eq!(withdraw_type, ElemType::WITHDRAW);
Variants§
Implementations§
source§impl ElemType
impl ElemType
sourcepub fn is_announce(&self) -> bool
pub fn is_announce(&self) -> bool
Checks if the ElemType
is an announce.
Returns true
if ElemType
is ANNOUNCE
, and false
if it is WITHDRAW
.
§Examples
use bgpkit_parser::models::ElemType;
let elem = ElemType::ANNOUNCE;
assert_eq!(elem.is_announce(), true);
let elem = ElemType::WITHDRAW;
assert_eq!(elem.is_announce(), false);
Trait Implementations§
source§impl PartialEq for ElemType
impl PartialEq for ElemType
impl Copy for ElemType
impl Eq for ElemType
impl StructuralPartialEq for ElemType
Auto Trait Implementations§
impl Freeze for ElemType
impl RefUnwindSafe for ElemType
impl Send for ElemType
impl Sync for ElemType
impl Unpin for ElemType
impl UnwindSafe for ElemType
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.