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§
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.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>
Converts
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>
Converts
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