[][src]Struct bcder::int::Unsigned

pub struct Unsigned(_);

A BER encoded unsigned integer.

As integers are variable length in BER, this type is just a simple wrapper atop the underlying Bytes value containing the raw content. It guarantees that the wrapped integer is greater or equal to 0. This equals an integer defined as INTEGER (0..MAX) in ASN.1.

If you need a integer without any restrictions, you can use Integer. If you have even stricter range restrictions, you can also use the methods provided on the content types to decode into Rust’s primitive integer types such as u16.

BER Encoding

In BER, an INTEGER is encoded as a primitive value with the content octets providing a variable-length, big-endian, two‘s complement byte sequence of that integer. Thus, the most-significant bit of the first octet serves as the sign bit and, for an unsigned integer, has to be unset.

Methods

impl Unsigned[src]

pub fn take_from<S: Source>(cons: &mut Constructed<S>) -> Result<Self, S::Err>[src]

pub fn from_primitive<S: Source>(
    prim: &mut Primitive<S>
) -> Result<Self, S::Err>
[src]

pub fn u8_from_primitive<S: Source>(
    prim: &mut Primitive<S>
) -> Result<u8, S::Err>
[src]

pub fn u16_from_primitive<S: Source>(
    prim: &mut Primitive<S>
) -> Result<u16, S::Err>
[src]

pub fn u32_from_primitive<S: Source>(
    prim: &mut Primitive<S>
) -> Result<u32, S::Err>
[src]

pub fn u64_from_primitive<S: Source>(
    prim: &mut Primitive<S>
) -> Result<u64, S::Err>
[src]

pub fn u128_from_primitive<S: Source>(
    prim: &mut Primitive<S>
) -> Result<u128, S::Err>
[src]

Trait Implementations

impl<'a> PrimitiveContent for &'a Unsigned[src]

impl From<u8> for Unsigned[src]

impl From<u16> for Unsigned[src]

impl From<u32> for Unsigned[src]

impl From<u64> for Unsigned[src]

impl From<u128> for Unsigned[src]

impl Clone for Unsigned[src]

impl PartialOrd<Unsigned> for Unsigned[src]

impl AsRef<Integer> for Unsigned[src]

impl AsRef<Bytes> for Unsigned[src]

impl AsRef<[u8]> for Unsigned[src]

impl Eq for Unsigned[src]

impl Ord for Unsigned[src]

impl PartialEq<Unsigned> for Integer[src]

impl PartialEq<Unsigned> for Unsigned[src]

impl Debug for Unsigned[src]

impl Hash for Unsigned[src]

Auto Trait Implementations

Blanket Implementations

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]