Enum decon_spf::mechanism::Kind

source ·
pub enum Kind {
    Redirect,
    A,
    MX,
    Include,
    IpV4,
    IpV6,
    Ptr,
    Exists,
    All,
}
Expand description

Defines the possible mechanisms.

Variants§

§

Redirect

Represents a Modifier of type redirect=
If this is present, the All mechanism should not be present.

§

A

Represents a Mechanism of type A

§Possible Values:

a   
a/24  
a:example.com  
a:example.com/24  
§

MX

Represents a Mechanism of type MX
Possible values follow the same layout as for A

§

Include

Represents a Mechanism of type Include

include:<domain>
§

IpV4

Represents a Mechanism of type ip4

§Example Values:

ip4:192.168.11.0/24  
ip4:10.10.1.1
§

IpV6

Represents a Mechanism of type ip6

§

Ptr

Represents a Mechanism of type ptr

§Note:

This is rarely use.

§

Exists

Represents a Mechanism of type exists

 ptr
 ptr:<domain>
§

All

Represents a Mechanism of type All

Implementations§

source§

impl Kind

source

pub fn is_redirect(&self) -> bool

Returns true if the mechanism is Redirect.

source

pub fn is_a(&self) -> bool

Returns true if the mechanism is A.

source

pub fn is_mx(&self) -> bool

Returns true if the mechanism is MX.

source

pub fn is_include(&self) -> bool

Returns true if the mechanism is Include.

source

pub fn is_ip(&self) -> bool

Returns true if it is of any ip. V4 or V6

§Examples:
let ip4 = Kind::IpV4;
let ip6 = Kind::IpV6;
assert_eq!(ip4.is_ip_v4(), true);
assert_eq!(ip4.is_ip_v6(), false);
assert_eq!(ip4.is_ip(), true);
assert_eq!(ip6.is_ip_v6(), true);
assert_eq!(ip6.is_ip_v4(), false);
assert_eq!(ip6.is_ip(), true);
source

pub fn is_ip_v4(&self) -> bool

Returns true if the mechanism is IpV4.

source

pub fn is_ip_v6(&self) -> bool

Returns true if the mechanism is IpV6.

source

pub fn is_ptr(&self) -> bool

Returns true if the mechanism is Ptr.

source

pub fn is_exists(&self) -> bool

Returns true if the mechanism is Exists.

source

pub fn is_all(&self) -> bool

Returns true if the mechanism is All.

source

pub fn as_str(&self) -> &str

Returns a reference to the str for kind enums.

§Examples:
let a = Kind::A;
let mx = Kind::MX;
assert_eq!(a.as_str(), "a");
assert_eq!(a.is_a(), true);
assert_eq!(mx.as_str(), "mx");
assert_eq!(mx.is_mx(), true);

Trait Implementations§

source§

impl Clone for Kind

source§

fn clone(&self) -> Kind

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Kind

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Kind

source§

fn default() -> Kind

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Kind

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Kind

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Kind

source§

fn eq(&self, other: &Kind) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Kind

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for Kind

source§

impl StructuralPartialEq for Kind

Auto Trait Implementations§

§

impl Freeze for Kind

§

impl RefUnwindSafe for Kind

§

impl Send for Kind

§

impl Sync for Kind

§

impl Unpin for Kind

§

impl UnwindSafe for Kind

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,