fgoxide/
lib.rs

1//! There are many helper functions that are used repeatedly across projects, such as serializing an
2//! iterator of `Serializable` objects to a file. This crate aims to collect those usage patterns,
3//! refine the APIs around them, and provide well tested code to be used across projects.
4#![forbid(unsafe_code)]
5
6pub mod io;
7pub mod iter;
8
9use thiserror::Error;
10
11/// Error types for `fgoxide`
12#[derive(Error, Debug)]
13pub enum FgError {
14    #[error("Error invoking underlying IO operation.")]
15    IoError(#[from] std::io::Error),
16
17    #[error("Error parsing/formatting delimited data.")]
18    ConversionError(#[from] csv::Error),
19
20    #[error("Error parsing delimited data file header.")]
21    DelimFileHeaderError { expected: String, found: String },
22}
23
24/// Result type that should be used everywhere
25type Result<A> = std::result::Result<A, FgError>;