Struct asn1_rs::TaggedParserBuilder
source · [−]pub struct TaggedParserBuilder<TagKind, E = Error> { /* private fields */ }
Expand description
A builder for parsing tagged values (IMPLICIT
or EXPLICIT
)
Examples
use asn1_rs::{Class, Tag, TaggedParserBuilder};
let parser = TaggedParserBuilder::explicit()
.with_class(Class::ContextSpecific)
.with_tag(Tag(0))
.der_parser::<u32>();
let input = &[0xa0, 0x03, 0x02, 0x01, 0x02];
let (rem, tagged) = parser(input).expect("parsing failed");
assert!(rem.is_empty());
assert_eq!(tagged.tag(), Tag(0));
assert_eq!(tagged.as_ref(), &2);
Implementations
sourceimpl<TagKind, E> TaggedParserBuilder<TagKind, E>
impl<TagKind, E> TaggedParserBuilder<TagKind, E>
sourcepub const fn with_class(self, class: Class) -> Self
pub const fn with_class(self, class: Class) -> Self
Set the expected Class
for the builder
sourceimpl<E> TaggedParserBuilder<Explicit, E>
impl<E> TaggedParserBuilder<Explicit, E>
sourceimpl<E> TaggedParserBuilder<Implicit, E>
impl<E> TaggedParserBuilder<Implicit, E>
sourceimpl<TagKind, E> TaggedParserBuilder<TagKind, E>
impl<TagKind, E> TaggedParserBuilder<TagKind, E>
sourcepub fn ber_parser<'a, T>(
self
) -> impl Fn(&'a [u8]) -> ParseResult<'a, TaggedParser<'a, TagKind, T, E>, E> where
TaggedParser<'a, TagKind, T, E>: FromBer<'a, E>,
E: From<Error>,
pub fn ber_parser<'a, T>(
self
) -> impl Fn(&'a [u8]) -> ParseResult<'a, TaggedParser<'a, TagKind, T, E>, E> where
TaggedParser<'a, TagKind, T, E>: FromBer<'a, E>,
E: From<Error>,
Create the BER parser from the builder parameters
This method will consume the builder and return a parser (to be used as a function).
sourceimpl<TagKind, E> TaggedParserBuilder<TagKind, E>
impl<TagKind, E> TaggedParserBuilder<TagKind, E>
sourcepub fn der_parser<'a, T>(
self
) -> impl Fn(&'a [u8]) -> ParseResult<'a, TaggedParser<'a, TagKind, T, E>, E> where
TaggedParser<'a, TagKind, T, E>: FromDer<'a, E>,
E: From<Error>,
pub fn der_parser<'a, T>(
self
) -> impl Fn(&'a [u8]) -> ParseResult<'a, TaggedParser<'a, TagKind, T, E>, E> where
TaggedParser<'a, TagKind, T, E>: FromDer<'a, E>,
E: From<Error>,
Create the DER parser from the builder parameters
This method will consume the builder and return a parser (to be used as a function).
Trait Implementations
sourceimpl<TagKind: Clone, E: Clone> Clone for TaggedParserBuilder<TagKind, E>
impl<TagKind: Clone, E: Clone> Clone for TaggedParserBuilder<TagKind, E>
sourcefn clone(&self) -> TaggedParserBuilder<TagKind, E>
fn clone(&self) -> TaggedParserBuilder<TagKind, E>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<TagKind: Debug, E: Debug> Debug for TaggedParserBuilder<TagKind, E>
impl<TagKind: Debug, E: Debug> Debug for TaggedParserBuilder<TagKind, E>
impl<TagKind: Copy, E: Copy> Copy for TaggedParserBuilder<TagKind, E>
Auto Trait Implementations
impl<TagKind, E> RefUnwindSafe for TaggedParserBuilder<TagKind, E> where
E: RefUnwindSafe,
TagKind: RefUnwindSafe,
impl<TagKind, E> Send for TaggedParserBuilder<TagKind, E> where
E: Send,
TagKind: Send,
impl<TagKind, E> Sync for TaggedParserBuilder<TagKind, E> where
E: Sync,
TagKind: Sync,
impl<TagKind, E> Unpin for TaggedParserBuilder<TagKind, E> where
E: Unpin,
TagKind: Unpin,
impl<TagKind, E> UnwindSafe for TaggedParserBuilder<TagKind, E> where
E: UnwindSafe,
TagKind: UnwindSafe,
Blanket Implementations
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