pub struct BigInt { /* private fields */ }Available on crate feature
alloc only.Expand description
A tagged bignum integer (CBOR tag 2 or 3).
SACP-CBOR/1 represents integers outside the safe range using CBOR tags 2 (positive) and 3 (negative), with a byte string magnitude encoded canonically (non-empty, no leading zeros).
Implementations§
Source§impl BigInt
impl BigInt
Sourcepub fn new(negative: bool, magnitude: Vec<u8>) -> Result<Self, CborError>
pub fn new(negative: bool, magnitude: Vec<u8>) -> Result<Self, CborError>
Construct a BigInt from sign and big-endian magnitude bytes.
§Errors
Returns an error if:
- the magnitude is empty or has a leading zero, or
- the represented integer would be within the safe integer range.
Sourcepub const fn is_negative(&self) -> bool
pub const fn is_negative(&self) -> bool
Sign flag: true if this represents a negative bignum (tag 3).
Trait Implementations§
Source§impl<'de> CborDecode<'de> for BigInt
impl<'de> CborDecode<'de> for BigInt
Source§impl CborEncode for BigInt
impl CborEncode for BigInt
Source§impl From<BigInt> for CborInteger
impl From<BigInt> for CborInteger
impl CborArrayElem for BigInt
impl Eq for BigInt
impl StructuralPartialEq for BigInt
Auto Trait Implementations§
impl Freeze for BigInt
impl RefUnwindSafe for BigInt
impl Send for BigInt
impl Sync for BigInt
impl Unpin for BigInt
impl UnsafeUnpin for BigInt
impl UnwindSafe for BigInt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more