rs_sort_uniq_count/
lib.rs

1use std::io;
2use std::str::FromStr;
3
4pub enum OutputMode {
5    Plain,
6    Json,
7}
8
9impl FromStr for OutputMode {
10    type Err = io::Error;
11
12    fn from_str(s: &str) -> Result<Self, Self::Err> {
13        match s {
14            "plain" => Ok(Self::Plain),
15            "json" => Ok(Self::Json),
16            _ => Err(io::Error::other(format!("unknown format: {s}"))),
17        }
18    }
19}
20
21pub const OUT_MODE_DEFAULT: OutputMode = OutputMode::Plain;
22
23pub mod count;