pub struct IndexedValue<I: Key, V: Value> {
pub index: I,
pub value: V,
}Expand description
A data type used in dup tables that have a subkey.
It allows having tables that map from a main key to a subkey (index) to a value (value).
The index/subkey type must have a fixed size declared in its AsDatabaseBytes implementation.
Otherwise, the code will panic at compile time.
Fields§
§index: IThe subkey or index.
value: VThe associated value.
Implementations§
Trait Implementations§
Source§impl<I: Key, V: Value> AsDatabaseBytes for IndexedValue<I, V>
impl<I: Key, V: Value> AsDatabaseBytes for IndexedValue<I, V>
Source§const FIXED_SIZE: Option<usize>
const FIXED_SIZE: Option<usize>
Determines whether the values are of fixed size.
This will set the
DUP_FIXED_SIZE_VALUES for dup tables flag.Source§fn as_key_bytes(&self) -> Cow<'_, [u8]>
fn as_key_bytes(&self) -> Cow<'_, [u8]>
Returns the byte representation to be used in key encoding.
In the default implementation, this will also be used for the value bytes.
Source§fn as_value_bytes(&self) -> Cow<'_, [u8]>
fn as_value_bytes(&self) -> Cow<'_, [u8]>
Returns the byte representation to be used in value encoding.
This is used if the value needs to be sorted differently in a dup table.
DUP values use a lexicographic sort order.
Source§impl<I: Clone + Key, V: Clone + Value> Clone for IndexedValue<I, V>
impl<I: Clone + Key, V: Clone + Value> Clone for IndexedValue<I, V>
Source§fn clone(&self) -> IndexedValue<I, V>
fn clone(&self) -> IndexedValue<I, V>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<I: Key, V: Value> DupTableValue for IndexedValue<I, V>
impl<I: Key, V: Value> DupTableValue for IndexedValue<I, V>
Source§impl<I: Key, V: Value> FromDatabaseBytes for IndexedValue<I, V>
impl<I: Key, V: Value> FromDatabaseBytes for IndexedValue<I, V>
Source§fn from_key_bytes(bytes: &[u8]) -> Selfwhere
Self: Sized,
fn from_key_bytes(bytes: &[u8]) -> Selfwhere
Self: Sized,
Reads the value from the database key bytes.
In the default implementation, this will also be used for the value bytes.
Source§fn from_value_bytes(bytes: &[u8]) -> Selfwhere
Self: Sized,
fn from_value_bytes(bytes: &[u8]) -> Selfwhere
Self: Sized,
Reads the value from the database bytes (in value encoding).
This is only necessary if the value needs to be sorted differently in a dup table.
DUP values use a lexicographic sort order.
Source§impl<I: PartialEq + Key, V: PartialEq + Value> PartialEq for IndexedValue<I, V>
impl<I: PartialEq + Key, V: PartialEq + Value> PartialEq for IndexedValue<I, V>
Source§fn eq(&self, other: &IndexedValue<I, V>) -> bool
fn eq(&self, other: &IndexedValue<I, V>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<I: Eq + Key, V: Eq + Value> Eq for IndexedValue<I, V>
impl<I: Key, V: Value> StructuralPartialEq for IndexedValue<I, V>
Auto Trait Implementations§
impl<I, V> Freeze for IndexedValue<I, V>
impl<I, V> RefUnwindSafe for IndexedValue<I, V>where
I: RefUnwindSafe,
V: RefUnwindSafe,
impl<I, V> Send for IndexedValue<I, V>
impl<I, V> Sync for IndexedValue<I, V>
impl<I, V> Unpin for IndexedValue<I, V>
impl<I, V> UnsafeUnpin for IndexedValue<I, V>where
I: UnsafeUnpin,
V: UnsafeUnpin,
impl<I, V> UnwindSafe for IndexedValue<I, V>where
I: UnwindSafe,
V: UnwindSafe,
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.