Skip to main content

TypedData

Enum TypedData 

Source
pub enum TypedData {
    Null,
    Bool(bool),
    Int32(i32),
    UInt32(u32),
    Int64(i64),
    UInt64(u64),
    IPv4(Ipv4Addr),
    IPv6(Ipv6Addr),
    String(String),
    Binary(Vec<u8>),
}

Variants§

§

Null

§

Bool(bool)

§

Int32(i32)

§

UInt32(u32)

§

Int64(i64)

§

UInt64(u64)

§

IPv4(Ipv4Addr)

§

IPv6(Ipv6Addr)

§

String(String)

§

Binary(Vec<u8>)

Implementations§

Source§

impl TypedData

Source

pub fn from_bytes(bytes: &[u8]) -> Option<Self>

Source

pub fn to_bytes(&self, buf: &mut Vec<u8>)

Source

pub fn serialized_len(&self) -> usize

Trait Implementations§

Source§

impl Clone for TypedData

Source§

fn clone(&self) -> TypedData

Returns a duplicate 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 TypedData

Source§

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

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

impl From<&str> for TypedData

Source§

fn from(value: &str) -> Self

Converts a &str into TypedData::String.

Source§

impl From<Ipv4Addr> for TypedData

Source§

fn from(value: Ipv4Addr) -> Self

Converts a Ipv4Addr into TypedData::IPv4(value).

Source§

impl From<Ipv6Addr> for TypedData

Source§

fn from(value: Ipv6Addr) -> Self

Converts a Ipv6Addr into TypedData::IPv6(value).

Source§

impl From<Option<&str>> for TypedData

Source§

fn from(value: Option<&str>) -> Self

Converts a Option<&str> into TypedData. If the value is None, it returns TypedData::Null. If the value is Some(value), it returns TypedData::String.

Source§

impl From<Option<Ipv4Addr>> for TypedData

Source§

fn from(value: Option<Ipv4Addr>) -> Self

Converts a Option<Ipv4Addr> into TypedData. If the value is None, it returns TypedData::Null. If the value is Some(value), it returns TypedData::IPv4(value).

Source§

impl From<Option<Ipv6Addr>> for TypedData

Source§

fn from(value: Option<Ipv6Addr>) -> Self

Converts a Option<Ipv6Addr> into TypedData. If the value is None, it returns TypedData::Null. If the value is Some(value), it returns TypedData::IPv6(value).

Source§

impl From<Option<String>> for TypedData

Source§

fn from(value: Option<String>) -> Self

Converts a Option<String> into TypedData. If the value is None, it returns TypedData::Null. If the value is Some(value), it returns TypedData::String(value).

Source§

impl From<Option<Vec<u8>>> for TypedData

Source§

fn from(value: Option<Vec<u8>>) -> Self

Converts a Option<Vec<u8>> into TypedData. If the value is None, it returns TypedData::Null. If the value is Some(value), it returns TypedData::Binary(value).

Source§

impl From<Option<bool>> for TypedData

Source§

fn from(value: Option<bool>) -> Self

Converts a Option<bool> into TypedData. If the value is None, it returns TypedData::Null. If the value is Some(value), it returns TypedData::Bool(value).

Source§

impl From<Option<i32>> for TypedData

Source§

fn from(value: Option<i32>) -> Self

Converts a Option<i32> into TypedData. If the value is None, it returns TypedData::Null. If the value is Some(value), it returns TypedData::Int32(value).

Source§

impl From<Option<i64>> for TypedData

Source§

fn from(value: Option<i64>) -> Self

Converts a Option<i64> into TypedData. If the value is None, it returns TypedData::Null. If the value is Some(value), it returns TypedData::Int64(value).

Source§

impl From<Option<u32>> for TypedData

Source§

fn from(value: Option<u32>) -> Self

Converts a Option<u32> into TypedData. If the value is None, it returns TypedData::Null. If the value is Some(value), it returns TypedData::UInt32(value).

Source§

impl From<Option<u64>> for TypedData

Source§

fn from(value: Option<u64>) -> Self

Converts a Option<u64> into TypedData. If the value is None, it returns TypedData::Null. If the value is Some(value), it returns TypedData::UInt64(value).

Source§

impl From<String> for TypedData

Source§

fn from(value: String) -> Self

Converts a String into TypedData::String(value).

Source§

impl From<Vec<u8>> for TypedData

Source§

fn from(value: Vec<u8>) -> Self

Converts a Vec<u8> into TypedData::Binary(value).

Source§

impl From<bool> for TypedData

Source§

fn from(value: bool) -> Self

Converts a bool into TypedData::Bool(value).

Source§

impl From<i32> for TypedData

Source§

fn from(value: i32) -> Self

Converts a i32 into TypedData::Int32(value).

Source§

impl From<i64> for TypedData

Source§

fn from(value: i64) -> Self

Converts a i64 into TypedData::Int64(value).

Source§

impl From<u32> for TypedData

Source§

fn from(value: u32) -> Self

Converts a u32 into TypedData::UInt32(value).

Source§

impl From<u64> for TypedData

Source§

fn from(value: u64) -> Self

Converts a u64 into TypedData::UInt64(value).

Source§

impl PartialEq for TypedData

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<TypedData> for Ipv4Addr

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData::IPv4 to a Ipv4Addr failing if the type conversion is invalid.

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Ipv6Addr

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData::IPv6 to a Ipv6Addr failing if the type conversion is invalid.

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Option<Ipv4Addr>

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData to an Option<Ipv4Addr> failing if the type conversion is invalid. If the value is TypedData::Null, it returns None. If the value is TypedData::IPv4 it returns Some(Ipv4Addr).

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Option<Ipv6Addr>

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData to an Option<Ipv6Addr> failing if the type conversion is invalid. If the value is TypedData::Null, it returns None. If the value is TypedData::IPv6 it returns Some(Ipv6Addr).

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Option<String>

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData to an Option<String> failing if the type conversion is invalid. If the value is TypedData::Null, it returns None. If the value is TypedData::String it returns Some(String).

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Option<Vec<u8>>

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData to an Option<Vec<u8>> failing if the type conversion is invalid. If the value is TypedData::Null, it returns None. If the value is TypedData::Binary it returns Some(Vec<u8>).

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Option<bool>

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData to an Option<bool> failing if the type conversion is invalid. If the value is TypedData::Null, it returns None. If the value is TypedData::Bool it returns Some(bool).

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Option<i32>

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData to an Option<i32> failing if the type conversion is invalid. If the value is TypedData::Null, it returns None. If the value is TypedData::Int32 it returns Some(i32).

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Option<i64>

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData to an Option<i64> failing if the type conversion is invalid. If the value is TypedData::Null, it returns None. If the value is TypedData::Int64 it returns Some(i64).

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Option<u32>

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData to an Option<u32> failing if the type conversion is invalid. If the value is TypedData::Null, it returns None. If the value is TypedData::UInt32 it returns Some(u32).

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Option<u64>

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData to an Option<u64> failing if the type conversion is invalid. If the value is TypedData::Null, it returns None. If the value is TypedData::UInt64 it returns Some(u64).

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for String

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData::String to a String failing if the type conversion is invalid.

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for Vec<u8>

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData::Binary to a Vec<u8> failing if the type conversion is invalid.

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for bool

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData::Bool to a bool failing if the type conversion is invalid.

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for i32

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData::Int32 to a i32 failing if the type conversion is invalid.

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for i64

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData::Int64 to a i64 failing if the type conversion is invalid.

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for u32

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData::UInt32 to a u32 failing if the type conversion is invalid.

Source§

type Error = TypedDataError

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

impl TryFrom<TypedData> for u64

Source§

fn try_from(value: TypedData) -> Result<Self, Self::Error>

Converts a TypedData::UInt64 to a u64 failing if the type conversion is invalid.

Source§

type Error = TypedDataError

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

impl Eq for TypedData

Source§

impl StructuralPartialEq for TypedData

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.