[−][src]Enum cborian::value::Int
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]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Int
[src]
pub fn cmp(&self, other: &Int) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Int> for Int
[src]
impl PartialOrd<Int> for Int
[src]
pub fn partial_cmp(&self, other: &Int) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Int) -> bool
[src]
pub fn le(&self, other: &Int) -> bool
[src]
pub fn gt(&self, other: &Int) -> bool
[src]
pub fn ge(&self, other: &Int) -> bool
[src]
impl StructuralEq for Int
[src]
impl StructuralPartialEq for Int
[src]
Auto Trait Implementations
impl RefUnwindSafe for Int
[src]
impl Send for Int
[src]
impl Sync for Int
[src]
impl Unpin for Int
[src]
impl UnwindSafe for Int
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,