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§
Source§impl<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
Source§impl<E> TaggedParserBuilder<Explicit, E>
impl<E> TaggedParserBuilder<Explicit, E>
Source§impl<E> TaggedParserBuilder<Implicit, E>
impl<E> TaggedParserBuilder<Implicit, E>
Source§impl<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>
pub fn ber_parser<'a, T>( self, ) -> impl Fn(&'a [u8]) -> ParseResult<'a, TaggedParser<'a, TagKind, T, E>, E>
Create the BER parser from the builder parameters
This method will consume the builder and return a parser (to be used as a function).
Source§impl<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>
pub fn der_parser<'a, T>( self, ) -> impl Fn(&'a [u8]) -> ParseResult<'a, TaggedParser<'a, TagKind, T, E>, E>
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§
Source§impl<TagKind: Clone, E: Clone> Clone for TaggedParserBuilder<TagKind, E>
impl<TagKind: Clone, E: Clone> Clone for TaggedParserBuilder<TagKind, E>
Source§fn clone(&self) -> TaggedParserBuilder<TagKind, E>
fn clone(&self) -> TaggedParserBuilder<TagKind, E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<TagKind, E> Default for TaggedParserBuilder<TagKind, E>
impl<TagKind, E> Default for TaggedParserBuilder<TagKind, E>
impl<TagKind: Copy, E: Copy> Copy for TaggedParserBuilder<TagKind, E>
Auto Trait Implementations§
impl<TagKind, E> Freeze for TaggedParserBuilder<TagKind, E>
impl<TagKind, E> RefUnwindSafe for TaggedParserBuilder<TagKind, E>where
TagKind: RefUnwindSafe,
E: RefUnwindSafe,
impl<TagKind, E> Send for TaggedParserBuilder<TagKind, E>
impl<TagKind, E> Sync for TaggedParserBuilder<TagKind, E>
impl<TagKind, E> Unpin for TaggedParserBuilder<TagKind, E>
impl<TagKind, E> UnwindSafe for TaggedParserBuilder<TagKind, E>where
TagKind: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes