Enum blaze_pk::types::Union

source ·
pub enum Union<C> {
    Set {
        key: u8,
        tag: String,
        value: C,
    },
    Unset,
}
Expand description

Type that can be unset or contain a pair of key values

Variants§

§

Set

Fields

§key: u8
§value: C

Set variant of a union value

§

Unset

Unset variant of a union value

Implementations§

source§

impl<C> Union<C>

source

pub fn unset() -> Self

Creates a new union with a unset value

source

pub fn set(key: u8, tag: &str, value: C) -> Self

Creates a new set union value with the provided key tag and value

source

pub fn is_set(&self) -> bool

Checks if the union is of set type

source

pub fn is_unset(&self) -> bool

Checks if the union is of unset type

source

pub fn unwrap(self) -> C

Unwraps the underlying value stored in this union panicing if the value is unset

Trait Implementations§

source§

impl<C: Debug> Debug for Union<C>

source§

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

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

impl<C> Decodable for Union<C>where C: Decodable + ValueType,

source§

fn decode(reader: &mut TdfReader<'_>) -> DecodeResult<Self>

Function for implementing decoding of Self from the provided Reader. Will return None if self cannot be decoded Read more
source§

impl<C> Encodable for Union<C>where C: Encodable + ValueType,

source§

fn encode(&self, output: &mut TdfWriter)

Function for implementing encoding of Self to the provided vec of bytes Read more
source§

fn encode_bytes(&self) -> Vec<u8>

Shortcut function for encoding self directly to a Vec of bytes
source§

impl<C> From<Union<C>> for Option<C>

source§

fn from(value: Union<C>) -> Self

Converts to this type from the input type.
source§

impl<C: PartialEq> PartialEq<Union<C>> for Union<C>

source§

fn eq(&self, other: &Union<C>) -> 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<C> ValueType for Union<C>

source§

fn value_type() -> TdfType

The type of tdf value this is
source§

impl<C: Eq> Eq for Union<C>

source§

impl<C> StructuralEq for Union<C>

source§

impl<C> StructuralPartialEq for Union<C>

Auto Trait Implementations§

§

impl<C> RefUnwindSafe for Union<C>where C: RefUnwindSafe,

§

impl<C> Send for Union<C>where C: Send,

§

impl<C> Sync for Union<C>where C: Sync,

§

impl<C> Unpin for Union<C>where C: Unpin,

§

impl<C> UnwindSafe for Union<C>where C: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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<D> FromRequest for Dwhere D: Decodable + Send + 'static,

source§

fn from_request(req: &Packet) -> Result<D, DecodeError>

Takes the value from the request returning a decode result of whether the value could be created Read more
source§

impl<F> FromRequestInternal for Fwhere F: FromRequest,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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<E> IntoResponse for Ewhere E: Encodable + 'static,

source§

fn into_response(self, req: &Packet) -> Packet

Into packet conversion
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more