der_parser::ber::compat

Type Alias BerSize

Source
pub type BerSize = Length;

Aliased Type§

enum BerSize {
    Definite(usize),
    Indefinite,
}

Variants§

§

Definite(usize)

Definite form (X.690 8.1.3.3)

§

Indefinite

Indefinite form (X.690 8.1.3.6)

Implementations

Source§

impl Length

Source

pub fn is_null(&self) -> bool

Return true if length is definite and equal to 0

Source

pub fn definite(&self) -> Result<usize, Error>

Get length of primitive object

Source

pub const fn is_definite(&self) -> bool

Return true if length is definite

Source

pub const fn assert_definite(&self) -> Result<(), Error>

Return error if length is not definite

Trait Implementations

Source§

impl Add<usize> for Length

Source§

type Output = Length

The resulting type after applying the + operator.
Source§

fn add(self, rhs: usize) -> <Length as Add<usize>>::Output

Performs the + operation. Read more
Source§

impl Add for Length

Source§

type Output = Length

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Length) -> <Length as Add>::Output

Performs the + operation. Read more
Source§

impl AddAssign<usize> for Length

Source§

fn add_assign(&mut self, rhs: usize)

Performs the += operation. Read more
Source§

impl Clone for Length

Source§

fn clone(&self) -> Length

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Length

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl DynTagged for Length

Source§

fn tag(&self) -> Tag

Source§

impl From<usize> for Length

Source§

fn from(l: usize) -> Length

Converts to this type from the input type.
Source§

impl PartialEq for Length

Source§

fn eq(&self, other: &Length) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToDer for Length

Source§

fn to_der_len(&self) -> Result<usize, Error>

Get the length of the object (including the header), when encoded
Source§

fn write_der_header( &self, writer: &mut dyn Write, ) -> Result<usize, SerializeError>

Attempt to write the DER header to this writer.
Source§

fn write_der_content( &self, _writer: &mut dyn Write, ) -> Result<usize, SerializeError>

Attempt to write the DER content (all except header) to this writer.
Source§

fn to_der_vec(&self) -> Result<Vec<u8>, SerializeError>

Write the DER encoded representation to a newly allocated Vec<u8>.
Source§

fn to_der_vec_raw(&self) -> Result<Vec<u8>, SerializeError>

Similar to using to_vec, but uses provided values without changes. This can generate an invalid encoding for a DER object.
Source§

fn write_der(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>

Attempt to write the DER encoded representation (header and content) into this writer. Read more
Source§

fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>

Similar to using to_der, but uses provided values without changes. This can generate an invalid encoding for a DER object.
Source§

impl Copy for Length

Source§

impl Eq for Length

Source§

impl StructuralPartialEq for Length