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§
Source§impl KeyDeserialize for PriceKey
impl KeyDeserialize for PriceKey
Source§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()
type Output = Price
fn from_vec(value: Vec<u8>) -> StdResult<Self::Output>
fn from_slice(value: &[u8]) -> Result<Self::Output, StdError>
Source§impl<'a> PrimaryKey<'a> for PriceKey
impl<'a> PrimaryKey<'a> for PriceKey
Source§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 = ()
Source§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 Freeze for PriceKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more