[][src]Trait gfa::optfields::OptFields

pub trait OptFields: Sized + Default + Clone {
    fn get_field(&self, tag: &[u8]) -> Option<&OptField>;
fn fields(&self) -> &[OptField];
fn parse<T>(input: T) -> Self
    where
        T: IntoIterator,
        T::Item: AsRef<[u8]>
; }

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]

Given an iterator over bytestrings, each expected to hold one optional field (in the :: format), parse them as optional fields to create a collection. Returns Self rather than Option<Self> for now, but this may be changed to become fallible in the future.

Loading content...

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.

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.

Loading content...

Implementors

Loading content...