pub struct Real(/* private fields */);Expand description
A CIM Float or Decimal value: the number, and the spelling it arrived in.
Like Mrid, two Reals denoting one number are equal whatever they were written
as, so a difference never reports a reformatting, while re-export reproduces the
spelling (2.62637E-05, 250.000000, -90E6).
A spelling is kept only when it is a conforming lexical form for the primitive it was
read as; tolerated deviations such as 1,5 or 1.5D+3
(Value::parse_primitive) are written back in canonical form.
Implementations§
Source§impl Real
impl Real
Sourcepub fn from_document(value: f64, text: &str, prim: Primitive) -> Real
pub fn from_document(value: f64, text: &str, prim: Primitive) -> Real
A number as a document wrote it.
The text is kept only when it differs from what this crate would write anyway and
is a conforming lexical form for prim — so a value that was already canonical
costs nothing, and a deviating one is repaired rather than echoed.
pub fn get(&self) -> f64
Sourcepub fn lexical(&self) -> Option<&str>
pub fn lexical(&self) -> Option<&str>
The spelling this value was read with, where it differs from the canonical form.
Sourcepub fn to_lexical_as(&self, prim: Primitive) -> String
pub fn to_lexical_as(&self, prim: Primitive) -> String
How to write it: the document’s spelling where there is one, else canonical.