Skip to content

stdlib/moneyView source ↗

money

6 items · generated by scribe fromstdlib/money.fd· synced 2026-11-15

stdlib/money6 items

Contents

Money_new

Create new money from a cents amount. This is the “mint” function. Calling this inside a @conserve function is a compile error.

pub fn Money_new(cents: i64) -> Money {

Parameters:

  • cents: i64

Returns: Money

Defined at line 23


Money_from_dollars

Create money from dollars and cents.

pub fn Money_from_dollars(dollars: i64, cents: i64) -> Money {

Parameters:

  • dollars: i64
  • cents: i64

Returns: Money

Defined at line 30


Money_from_cents

Make money from a cents value. A mint like Money_new: the cents are a plain number, so nothing proves they came from existing Money. Calling this inside a @conserve function is a compile error.

pub fn Money_from_cents(cents: i64) -> Money {

Parameters:

  • cents: i64

Returns: Money

Defined at line 39


Money_sub

a - b, both consumed: b and as much of a are destroyed. To pay b out of a and keep both, use Money_take. Not @conserve.

pub fn Money_sub(a: Money, b: Money) -> Money {

Parameters:

  • a: Money
  • b: Money

Returns: Money

Defined at line 85


Money_to_cents

The cents value, consuming the Money: it leaves the money system (a payout, a report at the end). Not @conserve; use Money_cents(&m) to read.

pub fn Money_to_cents(m: Money) -> i64 {

Parameters:

  • m: Money

Returns: i64

Defined at line 93


Money_print

Print money as dollars.cents (e.g. “$12.34”). NOT @conserve (has IO effect).

pub fn Money_print(m: Money) -> void {

Parameters:

  • m: Money

Returns: void

Defined at line 98


Generated by scribe, the Fides documentation generator