MCPcopy Create free account
hub / github.com/arraypad/each / Format

Interface Format

src/formats/mod.rs:14–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12pub const DEFAULT_FORMAT: &str = JsonId;
13
14pub trait Format {
15 fn add_arguments<'a>(&self, args: clap::Command<'a>) -> clap::Command<'a>;
16 fn set_arguments(&mut self, matches: &clap::ArgMatches) -> Result<(), Error>;
17 fn get_extensions(&self) -> &'static [&'static str];
18 fn is_valid_header(&self, header: &[u8]) -> Result<bool, Error>;
19 fn parse(&self, input: &mut dyn Read) -> Result<serde_json::Value, Error>;
20 fn write(&self, values: Vec<serde_json::Value>) -> Result<(), Error>;
21}
22
23pub fn load_formats() -> IndexMap<&'static str, Box<dyn Format>> {
24 let mut formats: IndexMap<&'static str, Box<dyn Format>> = IndexMap::new();

Callers

nothing calls this directly

Implementers 2

json.rssrc/formats/json.rs
csv.rssrc/formats/csv.rs

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…