pub struct Negative(_);
Expand description
CBOR Negative value
Implementations
sourceimpl Negative
impl Negative
sourcepub fn negative_u64(self) -> u64
pub fn negative_u64(self) -> u64
Extract the negative CBOR value into an unsigned value, which represent the integer : -1 - value
sourcepub fn to_i64(self) -> Option<i64>
pub fn to_i64(self) -> Option<i64>
Try to convert a negative CBOR number into a i64 representing the value
Note this operation might fail as the CBOR representation can represent any negative number between -1 and -(2^64-1), whereas i64 represent a number between -(2^63) to 2^63-1
sourcepub fn canonical(v: u64) -> Self
pub fn canonical(v: u64) -> Self
Create a canonical Negative element from a u64 that represent the CBOR integer -1 - value, taking the smallest possible CBOR representation
To represent the CBOR negative value -1, Negative::canonical(0)
sourcepub fn is_canonical(self) -> bool
pub fn is_canonical(self) -> bool
Check if the encoded Negative CBOR element have the smallest representation possible (canonical)
Trait Implementations
sourceimpl PartialEq<Negative> for Negative
impl PartialEq<Negative> for Negative
impl Copy for Negative
impl Eq for Negative
impl StructuralEq for Negative
impl StructuralPartialEq for Negative
Auto Trait Implementations
impl RefUnwindSafe for Negative
impl Send for Negative
impl Sync for Negative
impl Unpin for Negative
impl UnwindSafe for Negative
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more