pub struct WrappedDecimal(/* private fields */);Expand description
A fixed-size, POD-safe wrapper around rust_decimal::Decimal.
The decimal is stored as the 16-byte serialized representation from
rust_decimal, making this type suitable for account/state layouts that
require stable byte size.
Trait Implementations§
Source§impl BorshDeserialize for WrappedDecimal
impl BorshDeserialize for WrappedDecimal
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for WrappedDecimal
impl BorshSerialize for WrappedDecimal
Source§impl Clone for WrappedDecimal
impl Clone for WrappedDecimal
Source§fn clone(&self) -> WrappedDecimal
fn clone(&self) -> WrappedDecimal
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl From<Decimal> for WrappedDecimal
impl From<Decimal> for WrappedDecimal
Source§impl From<WrappedDecimal> for Decimal
impl From<WrappedDecimal> for Decimal
Source§fn from(w: WrappedDecimal) -> Self
fn from(w: WrappedDecimal) -> Self
Deserializes the wrapped 16-byte representation back into a Decimal.
Source§impl IdlBuild for WrappedDecimal
impl IdlBuild for WrappedDecimal
Source§fn create_type() -> Option<IdlTypeDef>
fn create_type() -> Option<IdlTypeDef>
Create an IDL type definition for the type. Read more
Source§fn insert_types(types: &mut BTreeMap<String, IdlTypeDef>)
fn insert_types(types: &mut BTreeMap<String, IdlTypeDef>)
Insert all types that are included in the current type definition to the given map.
Source§fn get_full_path() -> String
fn get_full_path() -> String
Get the full module path of the type. Read more
Source§impl Space for WrappedDecimal
impl Space for WrappedDecimal
const INIT_SPACE: usize
impl Copy for WrappedDecimal
impl Pod for WrappedDecimal
Auto Trait Implementations§
impl Freeze for WrappedDecimal
impl RefUnwindSafe for WrappedDecimal
impl Send for WrappedDecimal
impl Sync for WrappedDecimal
impl Unpin for WrappedDecimal
impl UnsafeUnpin for WrappedDecimal
impl UnwindSafe for WrappedDecimal
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.