pub struct SequenceIterator<'a, T, F> where
F: ASN1Parser, { /* private fields */ }
Available on crate feature
mtls
only.Expand description
An Iterator over binary data, parsing elements of type T
This helps parsing SEQUENCE OF
items of type T
. The type of parser
(BER/DER) is specified using the generic parameter F
of this struct.
Note: the iterator must start on the sequence contents, not the sequence itself.
Examples
use asn1_rs::{DerParser, Integer, SequenceIterator};
let data = &[0x30, 0x6, 0x2, 0x1, 0x1, 0x2, 0x1, 0x2];
for (idx, item) in SequenceIterator::<Integer, DerParser>::new(&data[2..]).enumerate() {
let item = item.unwrap(); // parsing could have failed
let i = item.as_u32().unwrap(); // integer can be negative, or too large to fit into u32
assert_eq!(i as usize, idx + 1);
}
Implementations
impl<'a, T, F> SequenceIterator<'a, T, F> where
F: ASN1Parser,
impl<'a, T, F> SequenceIterator<'a, T, F> where
F: ASN1Parser,
pub fn new(data: &'a [u8]) -> SequenceIterator<'a, T, F>
Trait Implementations
Auto Trait Implementations
impl<'a, T, F> RefUnwindSafe for SequenceIterator<'a, T, F> where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, F> Send for SequenceIterator<'a, T, F> where
F: Send,
T: Send,
impl<'a, T, F> Sync for SequenceIterator<'a, T, F> where
F: Sync,
T: Sync,
impl<'a, T, F> Unpin for SequenceIterator<'a, T, F> where
F: Unpin,
T: Unpin,
impl<'a, T, F> UnwindSafe for SequenceIterator<'a, T, F> where
F: UnwindSafe,
T: UnwindSafe,
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<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<I> IntoIterator for I where
I: Iterator,
impl<I> IntoIterator for I where
I: Iterator,
sourceimpl<I> IteratorRandom for I where
I: Iterator,
impl<I> IteratorRandom for I where
I: Iterator,
sourcefn choose<R>(self, rng: &mut R) -> Option<Self::Item> where
R: Rng + ?Sized,
fn choose<R>(self, rng: &mut R) -> Option<Self::Item> where
R: Rng + ?Sized,
Choose one element at random from the iterator. Read more
sourcefn choose_stable<R>(self, rng: &mut R) -> Option<Self::Item> where
R: Rng + ?Sized,
fn choose_stable<R>(self, rng: &mut R) -> Option<Self::Item> where
R: Rng + ?Sized,
Choose one element at random from the iterator. 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