pub struct NumberFormat { /* private fields */ }Expand description
How a source writes an amount, read once.
Built from the authored picture and never rebuilt: every engine is handed the same facts, so two engines cannot disagree about what the design said.
Implementations§
Source§impl NumberFormat
impl NumberFormat
Sourcepub fn parse(spelled: &str) -> Result<Self, NumberFormatError>
pub fn parse(spelled: &str) -> Result<Self, NumberFormatError>
Read a picture, or say what is wrong with it.
§Errors
Nothing at all, no digit place, a thousands mark in the wrong place or with the wrong number of places after it, two decimal points, digits on both sides of the symbol, or a second picture that is not the first one in brackets.
Sourcepub fn opens_with(&self) -> &str
pub fn opens_with(&self) -> &str
The symbol in front of the value, empty where there is none.
Sourcepub fn closes_with(&self) -> &str
pub fn closes_with(&self) -> &str
The symbol after the value, empty where there is none.
Sourcepub fn marks(&self) -> Vec<String>
pub fn marks(&self) -> Vec<String>
The marks that are not part of the number, in the order a reader takes them out.
The symbol that opens the value, the symbol that closes it, the thousands mark, and the brackets where the source writes a negative in them. What is left is digits, at most one decimal point and at most a leading minus.
Sourcepub fn shape_pattern(&self) -> String
pub fn shape_pattern(&self) -> String
The shape a value has to have, as a regular expression, for an engine whose own conversion raises rather than answering nothing.
It is built from the same picture the marks come from, so the guard and the reading cannot hold two opinions about one spelling. The value is matched with its surrounding spaces already gone.
Trait Implementations§
Source§impl Clone for NumberFormat
impl Clone for NumberFormat
Source§fn clone(&self) -> NumberFormat
fn clone(&self) -> NumberFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more