Struct der::IndefiniteLength
source · pub struct IndefiniteLength(/* private fields */);
Expand description
Length type with support for indefinite lengths as used by ASN.1 BER, as described in X.690 Section 8.1.3.6:
8.1.3.6 For the indefinite form, the length octets indicate that the contents octets are terminated by end-of-contents octets (see 8.1.5), and shall consist of a single octet.
8.1.3.6.1 The single octet shall have bit 8 set to one, and bits 7 to 1 set to zero.
8.1.3.6.2 If this form of length is used, then end-of-contents octets (see 8.1.5) shall be present in the encoding following the contents octets.
Indefinite lengths are non-canonical and therefore invalid DER, however there are interoperability corner cases where we have little choice but to tolerate some BER productions where this is helpful.
Implementations§
source§impl IndefiniteLength
impl IndefiniteLength
sourcepub fn new(length: impl Into<Length>) -> Self
pub fn new(length: impl Into<Length>) -> Self
Create a definite length from a type which can be converted into a
Length
.
sourcepub fn is_definite(self) -> bool
pub fn is_definite(self) -> bool
Is this length definite?
sourcepub fn is_indefinite(self) -> bool
pub fn is_indefinite(self) -> bool
Is this length indefinite?
Trait Implementations§
source§impl Clone for IndefiniteLength
impl Clone for IndefiniteLength
source§fn clone(&self) -> IndefiniteLength
fn clone(&self) -> IndefiniteLength
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for IndefiniteLength
impl Debug for IndefiniteLength
source§impl<'a> Decode<'a> for IndefiniteLength
impl<'a> Decode<'a> for IndefiniteLength
source§impl Encode for IndefiniteLength
impl Encode for IndefiniteLength
source§fn encoded_len(&self) -> Result<Length>
fn encoded_len(&self) -> Result<Length>
source§fn encode(&self, writer: &mut impl Writer) -> Result<()>
fn encode(&self, writer: &mut impl Writer) -> Result<()>
Writer
.source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
source§impl From<Length> for IndefiniteLength
impl From<Length> for IndefiniteLength
source§fn from(length: Length) -> IndefiniteLength
fn from(length: Length) -> IndefiniteLength
source§impl Ord for IndefiniteLength
impl Ord for IndefiniteLength
source§fn cmp(&self, other: &IndefiniteLength) -> Ordering
fn cmp(&self, other: &IndefiniteLength) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for IndefiniteLength
impl PartialEq for IndefiniteLength
source§fn eq(&self, other: &IndefiniteLength) -> bool
fn eq(&self, other: &IndefiniteLength) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for IndefiniteLength
impl PartialOrd for IndefiniteLength
source§fn partial_cmp(&self, other: &IndefiniteLength) -> Option<Ordering>
fn partial_cmp(&self, other: &IndefiniteLength) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl TryFrom<IndefiniteLength> for Length
impl TryFrom<IndefiniteLength> for Length
impl Copy for IndefiniteLength
impl Eq for IndefiniteLength
impl StructuralPartialEq for IndefiniteLength
Auto Trait Implementations§
impl Freeze for IndefiniteLength
impl RefUnwindSafe for IndefiniteLength
impl Send for IndefiniteLength
impl Sync for IndefiniteLength
impl Unpin for IndefiniteLength
impl UnwindSafe for IndefiniteLength
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)