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(u64)Pos(u64)

Methods

impl Int
[src]

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

impl Ord for Int
[src]

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

This method returns an Ordering between self and other. Read more

impl PartialOrd for Int
[src]

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

This method returns an ordering between self and other values if one exists. Read more

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

This method tests less than (for self and other) and is used by the < operator. Read more

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

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

This method tests greater than (for self and other) and is used by the > operator. Read more

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Eq for Int
[src]

impl PartialEq for Int
[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

impl Hash for Int
[src]

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

Feeds this value into the state given, updating the hasher as necessary.

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

Feeds a slice of this type into the state provided.

impl Debug for Int
[src]

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

Formats the value using the given formatter.

impl Copy for Int
[src]

impl Clone for Int
[src]

fn clone(&self) -> Int

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more