Skip to main content

KVP

Struct KVP 

Source
#[repr(C)]
pub struct KVP<TKey, TValue> { pub key: TKey, pub value: TValue, }
Expand description

Represents the (key, value) pair, but with #[repr(C)] ABI.

Fields§

§key: TKey§value: TValue

Implementations§

Source§

impl<TKey, TValue> KVP<TKey, TValue>

Source

pub const fn unpack(self) -> (TKey, TValue)

Unpacks the KVP and returns the key and value as a tuple.

Source

pub const unsafe fn unpack_ptr(ptr: *mut Self) -> (*mut TKey, *mut TValue)

Unpacks the KVP from a raw pointer and returns the key and value as a tuple of raw pointers.

§Safety

It is up to the caller to ensure that ptr is a valid, non-null pointer to a KVP.

Source

pub const fn as_ref_kvp(&self) -> KVP<&TKey, &TValue>

Converts reference to KVP into KVP of references.

Source

pub const fn as_mut_kvp(&mut self) -> KVP<&TKey, &mut TValue>

Converts mutable reference to KVP into KVP with key as a reference and value as a mutable reference.

Source

pub const fn as_tuple(&self) -> (&TKey, &TValue)

Returns references to the key and value as a tuple.

Source

pub const fn as_mut_tuple(&mut self) -> (&mut TKey, &mut TValue)

Returns mutable references to the key and value as a tuple.

Trait Implementations§

Source§

impl<TKey: TryClone, TValue: TryClone> Clone for KVP<TKey, TValue>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<TKey: Debug, TValue: Debug> Debug for KVP<TKey, TValue>

Source§

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

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

impl<'de, TKey: Deserialize<'de>, TValue: Deserialize<'de>> Deserialize<'de> for KVP<TKey, TValue>

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<TKey: Display, TValue: Display> Display for KVP<TKey, TValue>

Source§

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

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

impl<TKey: Eq, TValue: Eq> Eq for KVP<TKey, TValue>

Source§

impl<TKey, TValue> From<(TKey, TValue)> for KVP<TKey, TValue>

Source§

fn from((key, value): (TKey, TValue)) -> Self

Converts to this type from the input type.
Source§

impl<TKey, TValue> From<KVP<TKey, TValue>> for (TKey, TValue)

Source§

fn from(kvp: KVP<TKey, TValue>) -> Self

Converts to this type from the input type.
Source§

impl<TKey: Hash, TValue: Hash> Hash for KVP<TKey, TValue>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<TKey: PartialEq, TValue: PartialEq> PartialEq for KVP<TKey, TValue>

Source§

fn eq(&self, other: &KVP<TKey, TValue>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<TKey: ReprC, TValue: ReprC> ReprC for KVP<TKey, TValue>

Source§

const CHECK: ()

This field is used for const checks only.
Source§

impl<TKey: Serialize, TValue: Serialize> Serialize for KVP<TKey, TValue>

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<TKey, TValue> StructuralPartialEq for KVP<TKey, TValue>

Source§

impl<TKey: TryClone, TValue: TryClone> TryClone for KVP<TKey, TValue>

Source§

type Error = KVPTryCloneError<<TKey as TryClone>::Error, <TValue as TryClone>::Error>

Source§

fn try_clone(&self) -> Result<Self, Self::Error>

Tries to clone the type. Read more

Auto Trait Implementations§

§

impl<TKey, TValue> Freeze for KVP<TKey, TValue>
where TKey: Freeze, TValue: Freeze,

§

impl<TKey, TValue> RefUnwindSafe for KVP<TKey, TValue>
where TKey: RefUnwindSafe, TValue: RefUnwindSafe,

§

impl<TKey, TValue> Send for KVP<TKey, TValue>
where TKey: Send, TValue: Send,

§

impl<TKey, TValue> Sync for KVP<TKey, TValue>
where TKey: Sync, TValue: Sync,

§

impl<TKey, TValue> Unpin for KVP<TKey, TValue>
where TKey: Unpin, TValue: Unpin,

§

impl<TKey, TValue> UnsafeUnpin for KVP<TKey, TValue>
where TKey: UnsafeUnpin, TValue: UnsafeUnpin,

§

impl<TKey, TValue> UnwindSafe for KVP<TKey, TValue>
where TKey: UnwindSafe, TValue: UnwindSafe,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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