pub struct Money { /* private fields */ }Implementations§
Source§impl Money
impl Money
pub fn new(minor: i64, currency: Currency) -> Self
pub fn zero(currency: Currency) -> Self
pub fn parse_major(text: &str, currency: Currency) -> Result<Money>
pub fn format_major(&self) -> String
pub fn write_major(&self, out: &mut String)
pub fn minor(&self) -> i64
pub fn currency(&self) -> Currency
pub fn is_positive(&self) -> bool
pub fn is_zero(&self) -> bool
pub fn checked_add(self, other: Money) -> Result<Money>
pub fn checked_subtract(self, other: Money) -> Result<Money>
Trait Implementations§
Source§impl Cast for Money
impl Cast for Money
const COLUMNS: &'static [ColumnSpec]
fn encode(&self, out: &mut Vec<SqlValue>)
fn decode(row: &mut dyn ColumnReader) -> Result<Self>
const NULLABLE: bool = false
Source§const SENSITIVE: bool = false
const SENSITIVE: bool = false
A field holding it is never filtered, sorted, listed or searched, as
#[sensitive] ones.Source§const MOVES: Option<fn(&Self) -> Option<&'static Targets>> = None
const MOVES: Option<fn(&Self) -> Option<&'static Targets>> = None
Set for a value moving between listed states; a save of any other value skips the check.
Source§const HOLDS_STATES: bool
const HOLDS_STATES: bool
Set when a state anywhere in the value is checked on save, as a field’s of several.
fn refuse_unlisted_move( field: &str, stored: &Self, current: &Self, ) -> Result<(), Error>
impl Copy for Money
Source§impl<'de> Deserialize<'de> for Money
impl<'de> Deserialize<'de> for Money
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Money
impl StructuralPartialEq for Money
Auto Trait Implementations§
impl Forget for Money
impl Freeze for Money
impl RefUnwindSafe for Money
impl Send for Money
impl Sync for Money
impl Unpin for Money
impl UnsafeUnpin for Money
impl UnwindSafe for Money
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