pub struct Header<'a> { /* private fields */ }
mtls
only.Expand description
BER/DER object header (identifier and length)
Implementations
impl<'a> Header<'a>
impl<'a> Header<'a>
pub const fn new(
class: Class,
constructed: bool,
tag: Tag,
length: Length
) -> Header<'a>
pub const fn new(
class: Class,
constructed: bool,
tag: Tag,
length: Length
) -> Header<'a>
Build a new BER/DER header from the provided values
pub const fn new_simple(tag: Tag) -> Header<'a>
pub const fn new_simple(tag: Tag) -> Header<'a>
Build a new BER/DER header from the provided tag, with default values for other fields
pub fn with_class(self, class: Class) -> Header<'a>
pub fn with_class(self, class: Class) -> Header<'a>
Set the class of this Header
pub fn with_constructed(self, constructed: bool) -> Header<'a>
pub fn with_constructed(self, constructed: bool) -> Header<'a>
Set the constructed flags of this Header
pub fn with_length(self, length: Length) -> Header<'a>
pub fn with_length(self, length: Length) -> Header<'a>
Set the length of this Header
pub fn with_raw_tag(self, raw_tag: Option<Cow<'a, [u8]>>) -> Header<'a>
pub fn with_raw_tag(self, raw_tag: Option<Cow<'a, [u8]>>) -> Header<'a>
Update header to add reference to raw tag
pub const fn constructed(&self) -> bool
pub const fn constructed(&self) -> bool
Return true if this header has the ‘constructed’ flag.
pub const fn is_primitive(&self) -> bool
pub const fn is_primitive(&self) -> bool
Test if object is primitive
pub const fn is_constructed(&self) -> bool
pub const fn is_constructed(&self) -> bool
Test if object is constructed
pub const fn assert_class(&self, class: Class) -> Result<(), Error>
pub const fn assert_class(&self, class: Class) -> Result<(), Error>
Return error if class is not the expected class
pub const fn assert_tag(&self, tag: Tag) -> Result<(), Error>
pub const fn assert_tag(&self, tag: Tag) -> Result<(), Error>
Return error if tag is not the expected tag
pub const fn assert_primitive(&self) -> Result<(), Error>
pub const fn assert_primitive(&self) -> Result<(), Error>
Return error if object is not primitive
pub const fn assert_constructed(&self) -> Result<(), Error>
pub const fn assert_constructed(&self) -> Result<(), Error>
Return error if object is primitive
pub const fn is_universal(&self) -> bool
pub const fn is_universal(&self) -> bool
Test if object class is Universal
pub const fn is_application(&self) -> bool
pub const fn is_application(&self) -> bool
Test if object class is Application
pub const fn is_contextspecific(&self) -> bool
pub const fn is_contextspecific(&self) -> bool
Test if object class is Context-specific
pub const fn is_private(&self) -> bool
pub const fn is_private(&self) -> bool
Test if object class is Private
Trait Implementations
impl<'a> PartialEq<Header<'a>> for Header<'a>
impl<'a> PartialEq<Header<'a>> for Header<'a>
Compare two BER headers. len
fields are compared only if both objects have it set (same for raw_tag
)
impl<'_> ToDer for Header<'_>
impl<'_> ToDer for Header<'_>
fn to_der_len(&self) -> Result<usize, Error>
fn to_der_len(&self) -> Result<usize, Error>
Get the length of the object, when encoded Read more
fn write_der_header(
&self,
writer: &mut dyn Write
) -> Result<usize, SerializeError>
fn write_der_header(
&self,
writer: &mut dyn Write
) -> Result<usize, SerializeError>
Attempt to write the DER header to this writer.
fn write_der_content(
&self,
_writer: &mut dyn Write
) -> Result<usize, SerializeError>
fn write_der_content(
&self,
_writer: &mut dyn Write
) -> Result<usize, SerializeError>
Attempt to write the DER content (all except header) to this writer.
fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
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. Read more
fn to_der_vec(&self) -> Result<Vec<u8, Global>, SerializeError>
fn to_der_vec(&self) -> Result<Vec<u8, Global>, SerializeError>
Write the DER encoded representation to a newly allocated Vec<u8>
.
fn to_der_vec_raw(&self) -> Result<Vec<u8, Global>, SerializeError>
fn to_der_vec_raw(&self) -> Result<Vec<u8, Global>, SerializeError>
Similar to using to_vec
, but uses provided values without changes.
This can generate an invalid encoding for a DER object. Read more
impl<'_> Eq for Header<'_>
Auto Trait Implementations
impl<'a> RefUnwindSafe for Header<'a>
impl<'a> Send for Header<'a>
impl<'a> Sync for Header<'a>
impl<'a> Unpin for Header<'a>
impl<'a> UnwindSafe for Header<'a>
Blanket Implementations
impl<'a, T> AsTaggedExplicit<'a> for T where
T: 'a,
impl<'a, T> AsTaggedExplicit<'a> for T where
T: 'a,
fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self>
impl<'a, T> AsTaggedImplicit<'a> for T where
T: 'a,
impl<'a, T> AsTaggedImplicit<'a> for T where
T: 'a,
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
sourcefn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
F: FnMut(T) -> U,
A: Array<Item = U>,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more