Skip to main content

ToFloat

Trait ToFloat 

Source
pub trait ToFloat {
    // Required methods
    fn to_f32(&self) -> Result<f32, ()>;
    fn to_f64(&self) -> Result<f64, ()>;
}
Expand description

Convert a number type into a float.

Required Methods§

Source

fn to_f32(&self) -> Result<f32, ()>

Return the number as an f32, or Err(()) if the conversion is not possible.

Source

fn to_f64(&self) -> Result<f64, ()>

Return the number as an f64, or Err(()) if the conversion is not possible.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ToFloat for style::values::specified::number::Number

Source§

impl ToFloat for style::values::computed::Number

Source§

impl ToFloat for ScaleFactor