Struct rutie::Float[][src]

pub struct Float { /* fields omitted */ }

Float

Implementations

impl Float[src]

pub fn new(num: f64) -> Self[src]

Creates a new Float.

Examples

use rutie::{Float, VM};

let float = Float::new(1.23);

assert_eq!(float.to_f64(), 1.23);

Ruby:

1.23 == 1.23

pub fn to_f64(&self) -> f64[src]

Retrieves an f64 value from Float.

Examples

use rutie::{Float, VM};

let float = Float::new(1.23);

assert_eq!(float.to_f64(), 1.23);

Ruby:

1.23 == 1.23

pub fn implicit_to_f(object: impl Object) -> Result<Float, AnyException>[src]

Cast any object to a Float implicitly, otherwise returns an AnyException

Examples

use rutie::{Integer, Float, Object, VM};

let integer = Integer::new(3);

assert_eq!(Float::implicit_to_f(integer), Ok(Float::new(3.0)));

Ruby:

Float(3) == 3.0

Trait Implementations

impl Debug for Float[src]

impl From<Value> for Float[src]

impl Into<AnyObject> for Float[src]

impl Into<Value> for Float[src]

impl Object for Float[src]

impl PartialEq<Float> for Float[src]

impl VerifiedObject for Float[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.