Struct Header
pub struct Header<'a> { /* private fields */ }
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
pub const fn assert_definite(&self) -> Result<(), Error>
pub const fn assert_definite(&self) -> Result<(), Error>
Return error if object length is definite
Trait Implementations§
§impl<'a> PartialEq for Header<'a>
Compare two BER headers. len
fields are compared only if both objects have it set (same for raw_tag
)
impl<'a> PartialEq 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>
§fn write_der_header(
&self,
writer: &mut dyn Write,
) -> Result<usize, SerializeError>
fn write_der_header( &self, writer: &mut dyn Write, ) -> Result<usize, SerializeError>
§fn write_der_content(
&self,
_writer: &mut dyn Write,
) -> Result<usize, SerializeError>
fn write_der_content( &self, _writer: &mut dyn Write, ) -> Result<usize, SerializeError>
§fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
to_der
, but uses provided values without changes.
This can generate an invalid encoding for a DER object.§fn to_der_vec(&self) -> Result<Vec<u8>, SerializeError>
fn to_der_vec(&self) -> Result<Vec<u8>, SerializeError>
Vec<u8>
.§fn to_der_vec_raw(&self) -> Result<Vec<u8>, SerializeError>
fn to_der_vec_raw(&self) -> Result<Vec<u8>, SerializeError>
to_vec
, but uses provided values without changes.
This can generate an invalid encoding for a DER object.impl Eq for Header<'_>
Auto Trait Implementations§
impl<'a> Freeze for Header<'a>
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, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more