Struct apollo_compiler::ast::IntValue
source · pub struct IntValue(/* private fields */);
Implementations§
source§impl IntValue
impl IntValue
sourcepub fn new_parsed(text: &str) -> Self
pub fn new_parsed(text: &str) -> Self
Constructs from a string matching the IntValue
grammar specification
To convert an i32
, use from
or into
instead.
sourcepub fn try_to_i32(&self) -> Result<i32, ParseIntError>
pub fn try_to_i32(&self) -> Result<i32, ParseIntError>
Converts to i32
, returning an error on overflow
Note: parsing is expected to succeed with a correctly-constructed IntValue
,
leaving overflow as the only error case.
sourcepub fn try_to_f64(&self) -> Result<f64, FloatOverflowError>
pub fn try_to_f64(&self) -> Result<f64, FloatOverflowError>
Converts to a finite f64
, returning an error on overflow to infinity
An IntValue
signals integer syntax was used, but is also valid in contexts
where a Float
is expected.
Note: parsing is expected to succeed with a correctly-constructed IntValue
,
leaving overflow as the only error case.
Trait Implementations§
source§impl PartialEq for IntValue
impl PartialEq for IntValue
impl Eq for IntValue
impl StructuralEq for IntValue
impl StructuralPartialEq for IntValue
Auto Trait Implementations§
impl RefUnwindSafe for IntValue
impl Send for IntValue
impl Sync for IntValue
impl Unpin for IntValue
impl UnwindSafe for IntValue
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.