Struct levana_perpswap_cosmos_msg::prelude::PriceKey
pub struct PriceKey(/* private fields */);
Expand description
A modified version of a Price used as a key in a Map
.
Due to how cw-storage-plus works, we need to have a reference to a slice,
which we can’t get from a Decimal256
. Instead, we store an array directly
here and provide conversion functions.
Trait Implementations§
§impl KeyDeserialize for PriceKey
impl KeyDeserialize for PriceKey
type Output = Price
§const KEY_ELEMS: u16 = 1u16
const KEY_ELEMS: u16 = 1u16
The number of key elements is used for the deserialization of compound keys.
It should be equal to PrimaryKey::key().len()
fn from_vec( value: Vec<u8> ) -> Result<<PriceKey as KeyDeserialize>::Output, StdError>
fn from_slice(value: &[u8]) -> Result<Self::Output, StdError>
§impl<'a> PrimaryKey<'a> for PriceKey
impl<'a> PrimaryKey<'a> for PriceKey
§type Prefix = ()
type Prefix = ()
These associated types need to implement
Prefixer
, so that they can be useful arguments
for prefix()
, sub_prefix()
, and their key-deserializable variants.type SubPrefix = ()
§type Suffix = PriceKey
type Suffix = PriceKey
These associated types need to implement
KeyDeserialize
, so that they can be returned from
range_de()
and friends.type SuperSuffix = PriceKey
fn joined_key(&self) -> Vec<u8>
fn joined_extra_key(&self, key: &[u8]) -> Vec<u8>
Auto Trait Implementations§
impl RefUnwindSafe for PriceKey
impl Send for PriceKey
impl Sync for PriceKey
impl Unpin for PriceKey
impl UnwindSafe for PriceKey
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere T: CastFrom<U>,
Casts
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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