Enum cbor::value::Int [−] [src]

pub enum Int {
    Neg(u64),
    Pos(u64),
}

Type to represent all possible CBOR integer values.

Since the encoding of negative integers (major type 1) follows unsigned integers (major type 0), mapping negative integers to i8, i16, i32 or i64 can result in integer overflows. If all possible values should be handled, this type can be used.

Variants

Neg
Pos

Methods

impl Int

fn from_u64(n: u64) -> Int

fn from_i64(n: i64) -> Int

fn i64(&self) -> Option<i64>

Map this value to an i64. If the value does not fit within [i64::MIN, i64::MAX], None is returned instead.

fn u64(&self) -> Option<u64>

Map this value to a u64. If the value is negative, None is returned instead.

Trait Implementations

Derived Implementations

impl Ord for Int

fn cmp(&self, __arg_0: &Int) -> Ordering

impl PartialOrd for Int

fn partial_cmp(&self, __arg_0: &Int) -> Option<Ordering>

fn lt(&self, __arg_0: &Int) -> bool

fn le(&self, __arg_0: &Int) -> bool

fn gt(&self, __arg_0: &Int) -> bool

fn ge(&self, __arg_0: &Int) -> bool

impl Eq for Int

impl PartialEq for Int

fn eq(&self, __arg_0: &Int) -> bool

fn ne(&self, __arg_0: &Int) -> bool

impl Hash for Int

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl Debug for Int

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Copy for Int

impl Clone for Int

fn clone(&self) -> Int

fn clone_from(&mut self, source: &Self)