Expand description
Represents a HCL number.
Variants
PosInt(u64)
Represents a positive integer.
NegInt(i64)
Represents a negative integer.
Float(f64)
Represents a float.
Implementations
sourceimpl Number
impl Number
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Represents the Number
as f64 if possible. Returns None otherwise.
sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
If the Number
is an integer, represent it as i64 if possible. Returns None otherwise.
sourcepub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
If the Number
is an integer, represent it as u64 if possible. Returns None otherwise.
sourcepub fn is_f64(&self) -> bool
pub fn is_f64(&self) -> bool
Returns true if the Number
is a float.
For any Number
on which is_f64
returns true, as_f64
is guaranteed to return the
float value.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Number
impl<'de> Deserialize<'de> for Number
sourcefn deserialize<D>(deserializer: D) -> Result<Number, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Number, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Number
Auto Trait Implementations
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnwindSafe for Number
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more