pub trait NumberBehavior {
Show 60 methods
// Required methods
fn set_u8(&mut self, value: u8);
fn set_u16(&mut self, value: u16);
fn set_u32(&mut self, value: u32);
fn set_u64(&mut self, value: u64);
fn set_u128(&mut self, value: u128);
fn set_i8(&mut self, value: i8);
fn set_i16(&mut self, value: i16);
fn set_i32(&mut self, value: i32);
fn set_i64(&mut self, value: i64);
fn set_i128(&mut self, value: i128);
fn set_f32(&mut self, value: f32);
fn set_f64(&mut self, value: f64);
fn get_u8(&self) -> Option<u8>;
fn get_u16(&self) -> Option<u16>;
fn get_u32(&self) -> Option<u32>;
fn get_u64(&self) -> Option<u64>;
fn get_u128(&self) -> Option<u128>;
fn get_i8(&self) -> Option<i8>;
fn get_i16(&self) -> Option<i16>;
fn get_i32(&self) -> Option<i32>;
fn get_i64(&self) -> Option<i64>;
fn get_i128(&self) -> Option<i128>;
fn get_f32(&self) -> Option<f32>;
fn get_f64(&self) -> Option<f64>;
fn get_u8_unsafe(&self) -> u8;
fn get_u16_unsafe(&self) -> u16;
fn get_u32_unsafe(&self) -> u32;
fn get_u64_unsafe(&self) -> u64;
fn get_u128_unsafe(&self) -> u128;
fn get_i8_unsafe(&self) -> i8;
fn get_i16_unsafe(&self) -> i16;
fn get_i32_unsafe(&self) -> i32;
fn get_i64_unsafe(&self) -> i64;
fn get_i128_unsafe(&self) -> i128;
fn get_f32_unsafe(&self) -> f32;
fn get_f64_unsafe(&self) -> f64;
fn is_i8(&self) -> bool;
fn is_i16(&self) -> bool;
fn is_i32(&self) -> bool;
fn is_i64(&self) -> bool;
fn is_i128(&self) -> bool;
fn is_u8(&self) -> bool;
fn is_u16(&self) -> bool;
fn is_u32(&self) -> bool;
fn is_u64(&self) -> bool;
fn is_u128(&self) -> bool;
fn is_f32(&self) -> bool;
fn is_f64(&self) -> bool;
fn is_number(&self) -> bool;
fn is_integer(&self) -> bool;
fn is_float(&self) -> bool;
fn is_signed(&self) -> bool;
fn is_unsigned(&self) -> bool;
fn is_zero(&self) -> bool;
fn is_positive(&self) -> bool;
fn is_negative(&self) -> bool;
fn number_type(&self) -> NumberType;
fn to_u64(&self) -> Option<u64>;
fn to_i64(&self) -> Option<i64>;
fn to_f64(&self) -> Option<f64>;
}Required Methods§
fn set_u16(&mut self, value: u16)
fn set_u32(&mut self, value: u32)
fn set_u64(&mut self, value: u64)
fn set_u128(&mut self, value: u128)
fn set_i8(&mut self, value: i8)
fn set_i16(&mut self, value: i16)
fn set_i32(&mut self, value: i32)
fn set_i64(&mut self, value: i64)
fn set_i128(&mut self, value: i128)
fn set_f32(&mut self, value: f32)
fn set_f64(&mut self, value: f64)
fn get_u16(&self) -> Option<u16>
fn get_u32(&self) -> Option<u32>
fn get_u64(&self) -> Option<u64>
fn get_u128(&self) -> Option<u128>
fn get_i8(&self) -> Option<i8>
fn get_i16(&self) -> Option<i16>
fn get_i32(&self) -> Option<i32>
fn get_i64(&self) -> Option<i64>
fn get_i128(&self) -> Option<i128>
fn get_f32(&self) -> Option<f32>
fn get_f64(&self) -> Option<f64>
Sourcefn get_u8_unsafe(&self) -> u8
fn get_u8_unsafe(&self) -> u8
Returns the u8 value stored in the Number struct, without checking if it exists.
§Safety
This function is unsafe because it can return an incorrect value if a u8 value is not
stored in the Number struct.
§Examples
let mut num = Number::default();
num.set_u8(42);
unsafe { assert_eq!(num.get_u8_unsafe(), 42) };