pub struct SequenceIterator<'a, T, F, E = Error>where
F: ASN1Parser,{ /* private fields */ }
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§
Trait Implementations§
Auto Trait Implementations§
impl<'a, T, F, E> Freeze for SequenceIterator<'a, T, F, E>
impl<'a, T, F, E> RefUnwindSafe for SequenceIterator<'a, T, F, E>
impl<'a, T, F, E> Send for SequenceIterator<'a, T, F, E>
impl<'a, T, F, E> Sync for SequenceIterator<'a, T, F, E>
impl<'a, T, F, E> Unpin for SequenceIterator<'a, T, F, E>
impl<'a, T, F, E> UnwindSafe for SequenceIterator<'a, T, F, E>
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<I> IntoIterator for Iwhere
I: Iterator,
impl<I> IntoIterator for Iwhere
I: Iterator,
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: 24 bytes