pub struct FastaReader<R: Read> { /* private fields */ }
Expand description

Parser for FASTA files. Only use this directly if you know your file is FASTA and that it is not compressed as it does not handle decompression. If you are unsure, it’s better to use parse_fastx_file.

Implementations§

source§

impl<R> Reader<R>where R: Read,

source

pub fn new(reader: R) -> Reader<R>

Creates a new reader with the default buffer size of 64 KiB

Example:
use needletail::parser::{FastaReader, FastxReader};
let fasta = b">id\nSEQUENCE";

let mut reader = FastaReader::new(&fasta[..]);
let record = reader.next().unwrap().unwrap();
assert_eq!(record.id(), b"id")
source

pub fn with_capacity(reader: R, capacity: usize) -> Reader<R>

Creates a new reader with a given buffer capacity. The minimum allowed capacity is 3.

source§

impl Reader<File>

source

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Reader<File>>

Creates a reader from a file path.

Example:
use needletail::parser::{FastaReader, FastxReader};

let mut reader = FastaReader::from_path("seqs.fasta").unwrap();

// (... do something with the reader)

Trait Implementations§

source§

impl<R: Read + Send> FastxReader for Reader<R>

source§

fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>>

Gets the next record in the stream. This imitates the Iterator API but does not support any iterator functions. This returns None once we reached the EOF.
source§

fn position(&self) -> &Position

Returns the current line/byte in the stream we are reading from
source§

fn line_ending(&self) -> Option<LineEnding>

Returns whether the current stream uses Windows or Unix style line endings It is None only before calling next, once next has been called it will always return a line ending.

Auto Trait Implementations§

§

impl<R> RefUnwindSafe for Reader<R>where R: RefUnwindSafe,

§

impl<R> Send for Reader<R>where R: Send,

§

impl<R> Sync for Reader<R>where R: Sync,

§

impl<R> Unpin for Reader<R>where R: Unpin,

§

impl<R> UnwindSafe for Reader<R>where R: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.