[][src]Enum cborian::value::Int

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)

Implementations

impl Int[src]

pub fn from_u64(n: u64) -> Int[src]

pub fn from_i64(n: i64) -> Int[src]

pub fn i64(&self) -> Option<i64>[src]

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

pub fn u64(&self) -> Option<u64>[src]

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

Trait Implementations

impl Clone for Int[src]

impl Copy for Int[src]

impl Debug for Int[src]

impl Eq for Int[src]

impl Hash for Int[src]

impl Ord for Int[src]

impl PartialEq<Int> for Int[src]

impl PartialOrd<Int> for Int[src]

impl StructuralEq for Int[src]

impl StructuralPartialEq for Int[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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,