pub struct FloatLiteral { /* private fields */ }Expand description
Represents a floating point literal
This struct is a representation of the text, that can be used to convert to both single- and double-precision floats.
FloatLiteral is not Copy-able because it contains a vector of the
digits from the source data.
Implementations§
Source§impl FloatLiteral
impl FloatLiteral
Sourcepub fn convert<F: FPFormat>(self) -> ConversionResult<F>
pub fn convert<F: FPFormat>(self) -> ConversionResult<F>
Convert the self to an f32 or f64 and return the precision of the
conversion.
Sourcepub fn from_bytes(data: &[u8]) -> Result<FloatLiteral, ParseError>
pub fn from_bytes(data: &[u8]) -> Result<FloatLiteral, ParseError>
Parse a slice of bytes into a FloatLiteral.
This is based on hexadecimal floating constants in the C11 specification, section 6.4.4.2.
Trait Implementations§
Source§impl Clone for FloatLiteral
impl Clone for FloatLiteral
Source§fn clone(&self) -> FloatLiteral
fn clone(&self) -> FloatLiteral
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FloatLiteral
impl Debug for FloatLiteral
Source§impl From<FloatLiteral> for f32
impl From<FloatLiteral> for f32
Source§fn from(literal: FloatLiteral) -> f32
fn from(literal: FloatLiteral) -> f32
Converts to this type from the input type.
Source§impl From<FloatLiteral> for f64
impl From<FloatLiteral> for f64
Source§fn from(literal: FloatLiteral) -> f64
fn from(literal: FloatLiteral) -> f64
Converts to this type from the input type.
Source§impl FromStr for FloatLiteral
impl FromStr for FloatLiteral
Source§type Err = ParseError
type Err = ParseError
The associated error which can be returned from parsing.
Source§fn from_str(s: &str) -> Result<FloatLiteral, ParseError>
fn from_str(s: &str) -> Result<FloatLiteral, ParseError>
Parses a string
s to return a value of this type. Read moreAuto Trait Implementations§
impl Freeze for FloatLiteral
impl RefUnwindSafe for FloatLiteral
impl Send for FloatLiteral
impl Sync for FloatLiteral
impl Unpin for FloatLiteral
impl UnwindSafe for FloatLiteral
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