entab/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![allow(clippy::module_name_repetitions)]
3#![deny(
4    missing_debug_implementations,
5    missing_docs,
6    missing_copy_implementations,
7    trivial_casts,
8    trivial_numeric_casts,
9    unreachable_pub,
10    unused_import_braces,
11    unused_qualifications,
12    unused_results
13)]
14//! entab is a library to parse different "record-formatted" file formats
15//! into tabular form.
16//!
17//! Entab provides two different ways to parse each file it supports. If you
18//! know the type of the file you'll be reading, you generally want to use the
19//! specific parser for that file type which will return a record of a specific
20//! type. For example, to parse the IDs out of a FASTA file you might do the
21//! following:
22//! ```
23//! # #[cfg(feature = "std")] {
24//! use std::fs::File;
25//! use entab::parsers::fasta::{FastaReader, FastaRecord};
26//!
27//! let file = File::open("./tests/data/sequence.fasta")?;
28//! let mut reader = FastaReader::new(file, None)?;
29//! while let Some(FastaRecord { id, .. }) = reader.next()? {
30//!     println!("{}", id);
31//! }
32//! # }
33//! # use entab::EtError;
34//! # Ok::<(), EtError>(())
35//! ```
36//!
37//! Alternatively, you may not know the type of file when writing your code so
38//! you may want to abstract over as many types as possible. This is where the
39//! slower, generic parser framework is used (for example, in the bindings
40//! for different languages). This framework can optionally take a `parser_name`
41//! to force it to use that specific parser and optional params to control
42//! parser options.
43//! ```
44//! # #[cfg(feature = "std")] {
45//! use std::fs::File;
46//! use entab::filetype::FileType;
47//! use entab::readers::get_reader;
48//!
49//! let file = File::open("./tests/data/sequence.fasta")?;
50//! let (mut reader, _) = get_reader(file, None, None)?;
51//! while let Some(record) = reader.next_record()? {
52//!     println!("{:?}", record[0]);
53//! }
54//! # }
55//! # use entab::EtError;
56//! # Ok::<(), EtError>(())
57//! ```
58
59extern crate alloc;
60
61/// The buffer interface that underlies the file readers
62pub mod buffer;
63/// Generic file decompression
64pub mod compression;
65/// Miscellanous utility functions and error handling
66pub mod error;
67/// File format inference
68pub mod filetype;
69/// Lightweight parsers to read records out of buffers
70pub mod parsers;
71/// Parsers for specific file formats
72pub mod readers;
73/// Record and abstract record reading
74pub mod record;
75
76pub use error::EtError;