You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
598 B
Rust
38 lines
598 B
Rust
//DEBUG:
|
|
#![allow(dead_code)]
|
|
|
|
use anyhow::Result;
|
|
use std::ops::Deref;
|
|
use parse::split_columns;
|
|
|
|
pub mod stdin;
|
|
pub mod parse;
|
|
|
|
pub const DEFAULT_SEP_PATTERN: &str = r"[\t]+";
|
|
|
|
type Column = Vec<String>;
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct Columns(Vec<Column>);
|
|
|
|
|
|
|
|
impl Deref for Columns {
|
|
type Target = Vec<Vec<String>>;
|
|
|
|
fn deref(&self) -> &Vec<Vec<String>> {
|
|
&self.0
|
|
}
|
|
|
|
}
|
|
|
|
// build Columns from &str
|
|
impl TryFrom<&str> for Columns {
|
|
type Error = anyhow::Error;
|
|
|
|
fn try_from(value: &str) -> Result<Self> {
|
|
split_columns(value, DEFAULT_SEP_PATTERN)
|
|
}
|
|
}
|
|
|