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§impl PartialOrd for IndefiniteLength
impl PartialOrd for IndefiniteLength
Source§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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)