pub struct Records<B, R: RecordsImplLayout> { /* private fields */ }
Expand description
A parsed sequence of records.
Records
represents a pre-parsed sequence of records whose structure is
enforced by the impl in R
.
Implementations§
Source§impl<B, R> Records<B, R>where
B: SplitByteSlice,
R: RecordsImpl,
impl<B, R> Records<B, R>where
B: SplitByteSlice,
R: RecordsImpl,
Sourcepub fn parse_with_context(
bytes: B,
context: R::Context,
) -> Result<Records<B, R>, R::Error>
pub fn parse_with_context( bytes: B, context: R::Context, ) -> Result<Records<B, R>, R::Error>
Parses a sequence of records with a context.
See parse_with_mut_context
for details on bytes
, context
, and
return value. parse_with_context
just calls parse_with_mut_context
with a mutable reference to the context
which is passed by value to
this function.
Sourcepub fn parse_with_mut_context(
bytes: B,
context: &mut R::Context,
) -> Result<Records<B, R>, R::Error>
pub fn parse_with_mut_context( bytes: B, context: &mut R::Context, ) -> Result<Records<B, R>, R::Error>
Parses a sequence of records with a mutable context.
context
may be used by implementers to maintain state while parsing
multiple records.
parse_with_mut_context
performs a single pass over all of the records
to verify that they are well-formed. Once parse_with_context
returns
successfully, the resulting Records
can be used to construct
infallible iterators.
Source§impl<B, R> Records<B, R>where
B: SplitByteSlice,
R: RecordsImpl<Context = ()>,
impl<B, R> Records<B, R>where
B: SplitByteSlice,
R: RecordsImpl<Context = ()>,
Source§impl<'a, B, R> Records<B, R>where
B: 'a + SplitByteSlice,
R: RecordsImpl,
impl<'a, B, R> Records<B, R>where
B: 'a + SplitByteSlice,
R: RecordsImpl,
Sourcepub fn iter(&'a self) -> RecordsIter<'a, &'a [u8], R> ⓘ
pub fn iter(&'a self) -> RecordsIter<'a, &'a [u8], R> ⓘ
Iterates over options.
Since the records were validated in parse
, then so long as
R::parse_with_context
is deterministic, the iterator is infallible.
Source§impl<'a, B, R> Records<B, R>where
B: SplitByteSlice + IntoByteSlice<'a>,
R: RecordsImpl,
impl<'a, B, R> Records<B, R>where
B: SplitByteSlice + IntoByteSlice<'a>,
R: RecordsImpl,
Sourcepub fn into_iter(self) -> RecordsIter<'a, B, R> ⓘ
pub fn into_iter(self) -> RecordsIter<'a, B, R> ⓘ
Iterates over options.
Since the records were validated in parse
, then so long as
R::parse_with_context
is deterministic, the iterator is infallible.
Trait Implementations§
Source§impl<B, R> FromRaw<RecordsRaw<B, R>, ()> for Records<B, R>where
R: RecordsImpl,
B: SplitByteSlice,
impl<B, R> FromRaw<RecordsRaw<B, R>, ()> for Records<B, R>where
R: RecordsImpl,
B: SplitByteSlice,
Source§type Error = <R as RecordsImplLayout>::Error
type Error = <R as RecordsImplLayout>::Error
Source§fn try_from_raw_with(raw: RecordsRaw<B, R>, _args: ()) -> Result<Self, R::Error>
fn try_from_raw_with(raw: RecordsRaw<B, R>, _args: ()) -> Result<Self, R::Error>
Self
from the raw form in raw
with args
.