[−][src]Trait gfa::optfields::OptFields
The OptFields trait describes how to parse, store, and query optional fields. Each of the GFA line types and the GFA struct itself are generic over the optional fields, so the choice of OptFields implementor can impact memory usage, which optional fields are parsed, and possibly more in the future
Required methods
fn get_field(&self, tag: &[u8]) -> Option<&OptField>
[src]
Return the optional field with the given tag, if it exists.
fn fields(&self) -> &[OptField]
[src]
Return a slice over all optional fields. NB: This may be replaced by an iterator or something else in the future
fn parse<T>(input: T) -> Self where
T: IntoIterator,
T::Item: AsRef<[u8]>,
[src]
T: IntoIterator,
T::Item: AsRef<[u8]>,
Given an iterator over bytestrings, each expected to hold one
optional field (in the Self
rather than Option<Self>
for now, but this may be changed to
become fallible in the future.
Implementations on Foreign Types
impl OptFields for ()
[src]
This implementation is useful for performance if we don't actually need any optional fields. () takes up zero space, and all methods are no-ops.
fn get_field(&self, _: &[u8]) -> Option<&OptField>
[src]
fn fields(&self) -> &[OptField]
[src]
fn parse<T>(_input: T) -> Self where
T: IntoIterator,
T::Item: AsRef<[u8]>,
[src]
T: IntoIterator,
T::Item: AsRef<[u8]>,
impl OptFields for Vec<OptField>
[src]
Stores all the optional fields in a vector. get_field
simply
uses std::iter::Iterator::find(), but as there are only a
relatively small number of optional fields in practice, it should
be efficient enough.
fn get_field(&self, tag: &[u8]) -> Option<&OptField>
[src]
fn fields(&self) -> &[OptField]
[src]
fn parse<T>(input: T) -> Self where
T: IntoIterator,
T::Item: AsRef<[u8]>,
[src]
T: IntoIterator,
T::Item: AsRef<[u8]>,