Struct gtmpl_value::Number
[−]
[src]
pub struct Number { /* fields omitted */ }
Internal number format for gtmpl_value
.
Methods
impl Number
[src]
pub fn as_i64(&self) -> Option<i64>
[src]
use std::i64; use gtmpl_value::Number; let big: Number = (i64::MAX as u64 + 10).into(); assert!(big.as_u64().is_some()); assert!(big.as_i64().is_none()); assert!(big.as_f64().is_none());
pub fn as_u64(&self) -> Option<u64>
[src]
use std::i64; use gtmpl_value::Number; let neg: Number = (-10).into(); assert!(neg.as_u64().is_none()); assert!(neg.as_i64().is_some()); assert!(neg.as_f64().is_some());
pub fn as_f64(&self) -> Option<f64>
[src]
use std::i64; use gtmpl_value::Number; let frac: Number = (10.1).into(); assert!(frac.as_u64().is_none()); assert!(frac.as_i64().is_none()); assert!(frac.as_f64().is_some());
Trait Implementations
impl Debug for Number
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for Number
[src]
fn clone(&self) -> Number
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for Number
[src]
fn eq(&self, __arg_0: &Number) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Number) -> bool
[src]
This method tests for !=
.
impl PartialOrd for Number
[src]
fn partial_cmp(&self, __arg_0: &Number) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Number) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Number) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Number) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Number) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Display for Number
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more