Trait cw_storage_plus::IntKey
source · pub trait IntKey: Sized + Copy {
type Buf: AsRef<[u8]> + AsMut<[u8]> + Into<Vec<u8>> + Default;
// Required methods
fn to_cw_bytes(&self) -> Self::Buf;
fn from_cw_bytes(bytes: Self::Buf) -> Self;
}
Expand description
Our int keys are simply the big-endian representation bytes for unsigned ints, but “sign-flipped” (xored msb) big-endian bytes for signed ints.
So that the representation of signed integers is in the right lexicographical order.
Required Associated Types§
Required Methods§
fn to_cw_bytes(&self) -> Self::Buf
fn from_cw_bytes(bytes: Self::Buf) -> Self
Object Safety§
This trait is not object safe.