Macaw.Data.Format.Measure (macaw_data v0.18.0)
View SourceA field's default format (spec/05 §6): how a measure's values are written with no
format given, built by Macaw.Data.Format.for_measure/2 and written by
Macaw.Data.Format.measure/2.
It is data: the resolved measure, the way its values are written (kind), and the
d3 formats it writes their numbers with, each a Macaw.Data.Format.
iex> {:ok, bytes} = Macaw.Data.Format.for_measure(%{unit: "By"})
iex> {bytes.kind, Macaw.Data.Format.measure(bytes, 1_500_000)}
{:quantity, "1.50 MB"}
Summary
Types
How a measure's values are written (spec/05 §6's table).
A number's notation with no measure; :fixed is a precision given alone.
Types
@type kind() :: :duration | :currency | :ratio | :count | :quantity | :unit | :number
How a measure's values are written (spec/05 §6's table).
@type notation() :: :auto | :plain | :grouped | :si | {:si, 3..24} | :fixed
A number's notation with no measure; :fixed is a precision given alone.
@type t() :: %Macaw.Data.Format.Measure{ currency: %{code: String.t(), symbol: String.t() | nil, amount: Macaw.Data.Format.t()} | nil, fixed: Macaw.Data.Format.t(), format: Macaw.Data.Format.t() | nil, kind: kind(), locale: Macaw.Data.Format.Locale.t(), measure: %{ unit: Macaw.Data.Unit.code() | nil, quantity: Macaw.Data.Quantity.t() | nil }, notation: notation(), precision: 0..20, style: :compound | :magnitude, system: :metric | :us | :uk | :as_posted }