pub(crate) enum Scalar {
Null,
Bool(bool),
Integer(i64),
Unsigned(u64),
Float(Finite),
String {
text: String,
style: StringStyle,
},
}Expand description
A null, boolean, number, or string leaf.
Variants§
Null
The null value.
Bool(bool)
A boolean.
Integer(i64)
An integer that fits i64.
Unsigned(u64)
An integer that does not fit i64 but fits u64.
Float(Finite)
A finite floating point number.
String
A string and the style it is rendered in.
Implementations§
Source§impl Scalar
impl Scalar
Sourcepub(crate) fn check(&self, format: Format) -> Result<(), ValueError>
pub(crate) fn check(&self, format: Format) -> Result<(), ValueError>
Check that format can write this scalar. A format that supports
literal strings can still lack the text of one.
§Errors
Returns the unsupported feature error for format.
Sourcepub(crate) fn number(number: &VNumber) -> Result<Self, ValueError>
pub(crate) fn number(number: &VNumber) -> Result<Self, ValueError>
Decode a number, keeping floats and integers apart.
§Errors
Returns ValueError::NonFinite for a non-finite float, and
ValueError::IntegerOutOfRange for an integer outside the i64 and
u64 ranges.
Trait Implementations§
impl StructuralPartialEq for Scalar
Auto Trait Implementations§
impl Freeze for Scalar
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnsafeUnpin for Scalar
impl UnwindSafe for Scalar
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