Trait deno_core::convert::Numeric

source ·
pub trait Numeric: Sized {
    const NAME: &'static str;

    // Required methods
    fn as_f64(self) -> f64;
    fn from_value(value: &Value) -> Option<Self>;
}
Expand description

A trait for types that can represent a JS number.

Required Associated Constants§

source

const NAME: &'static str

Required Methods§

source

fn as_f64(self) -> f64

source

fn from_value(value: &Value) -> Option<Self>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Numeric for f32

source§

const NAME: &'static str = "f32"

source§

fn from_value(value: &Value) -> Option<Self>

source§

fn as_f64(self) -> f64

source§

impl Numeric for f64

source§

const NAME: &'static str = "f64"

source§

fn from_value(value: &Value) -> Option<Self>

source§

fn as_f64(self) -> f64

source§

impl Numeric for i32

source§

const NAME: &'static str = "i32"

source§

fn from_value(value: &Value) -> Option<Self>

source§

fn as_f64(self) -> f64

source§

impl Numeric for i64

source§

const NAME: &'static str = "i64"

source§

fn from_value(value: &Value) -> Option<Self>

source§

fn as_f64(self) -> f64

source§

impl Numeric for isize

source§

const NAME: &'static str = "isize"

source§

fn from_value(value: &Value) -> Option<Self>

source§

fn as_f64(self) -> f64

source§

impl Numeric for u32

source§

const NAME: &'static str = "u32"

source§

fn from_value(value: &Value) -> Option<Self>

source§

fn as_f64(self) -> f64

source§

impl Numeric for u64

source§

const NAME: &'static str = "u64"

source§

fn from_value(value: &Value) -> Option<Self>

source§

fn as_f64(self) -> f64

source§

impl Numeric for usize

source§

const NAME: &'static str = "usize"

source§

fn from_value(value: &Value) -> Option<Self>

source§

fn as_f64(self) -> f64

Implementors§