pub struct Quantity { /* private fields */ }Expand description
Resolved order/trigger base quantity (protobuf qty_scaled).
Fields are private so metadata cannot be changed independently of the validated scaled value. Use the immutable metadata getters to inspect it.
Implementations§
Source§impl Quantity
impl Quantity
pub fn from_scaled( scaled: i64, scale: Option<u32>, domain: QuantityDomain, symbol: Option<String>, symbol_id: Option<u32>, ) -> Result<Self>
pub fn from_decimal_str( raw: &str, scale: u32, symbol: Option<String>, symbol_id: Option<u32>, ) -> Result<Self>
pub fn from_decimal( raw: Decimal, scale: u32, symbol: Option<String>, symbol_id: Option<u32>, ) -> Result<Self>
Sourcepub fn from_quote_scaled(
scaled: i64,
scale: u32,
symbol: Option<String>,
symbol_id: Option<u32>,
) -> Result<Self>
pub fn from_quote_scaled( scaled: i64, scale: u32, symbol: Option<String>, symbol_id: Option<u32>, ) -> Result<Self>
Construct a quote-debit budget from scaled integer units.
scale is required so a bare integer can never silently inherit the
catalog scale. Use crate::catalogs::Manager::quote_quantity_scale_for_symbol.
pub fn from_quote_decimal_str( raw: &str, scale: u32, symbol: Option<String>, symbol_id: Option<u32>, ) -> Result<Self>
pub fn from_quote_decimal( raw: Decimal, scale: u32, symbol: Option<String>, symbol_id: Option<u32>, ) -> Result<Self>
pub fn as_scaled(&self) -> i64
pub fn scale(&self) -> Option<u32>
pub fn domain(&self) -> QuantityDomain
pub fn symbol(&self) -> Option<&str>
pub fn symbol_id(&self) -> Option<u32>
pub fn format(&self, scale: Option<u32>) -> Result<String>
pub fn compatible_with( &self, domain: QuantityDomain, scale: Option<u32>, symbol: Option<&str>, symbol_id: Option<u32>, ) -> Result<()>
Trait Implementations§
impl Eq for Quantity
impl StructuralPartialEq for Quantity
Auto Trait Implementations§
impl Freeze for Quantity
impl RefUnwindSafe for Quantity
impl Send for Quantity
impl Sync for Quantity
impl Unpin for Quantity
impl UnsafeUnpin for Quantity
impl UnwindSafe for Quantity
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§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.