pub trait RecordsContext: Sized + Clone {
    // Provided method
    fn clone_for_iter(&self) -> Self { ... }
}
Expand description

The context kept while performing records parsing.

Types which implement RecordsContext can be used as the long-lived context which is kept during records parsing. This context allows parsers to keep running computations over the span of multiple records.

Provided Methods§

source

fn clone_for_iter(&self) -> Self

Clone a context for iterator purposes.

clone_for_iter is useful for cloning a context to be used by RecordsIter. Since Records::parse_with_context will do a full pass over all the records to check for errors, a RecordsIter should never error. Thereforce, instead of doing checks when iterating (if a context was used for checks), a clone of a context can be made specifically for iterator purposes that does not do checks (which may be expensive).

By default, just do a normal clone.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl RecordsContext for ()

source§

impl RecordsContext for usize

Implementors§