Skip to main content

RecordsContext

Trait RecordsContext 

Source
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

Clones 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. Therefore, 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).

The default implementation of this method is equivalent to Clone::clone.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl RecordsContext for ()

Source§

impl RecordsContext for usize

Implementors§