pub trait BashCodec {
// Required methods
fn emit(&self, val: &BashVal) -> Vec<String>;
fn parse(
&self,
words: &[String],
schema: &Schema,
) -> Result<BashVal, ParseError>;
// Provided methods
fn emit_literal(&self, val: &BashVal) -> String { ... }
fn parse_literal(
&self,
input: &str,
schema: &Schema,
) -> Result<BashVal, ParseError> { ... }
fn rows(&self, input: &str) -> Result<Vec<Vec<String>>, ParseError> { ... }
}Required Methods§
Provided Methods§
Sourcefn emit_literal(&self, val: &BashVal) -> String
fn emit_literal(&self, val: &BashVal) -> String
A complete bash array literal: (w1 w2 …), each scalar single-quoted.
fn parse_literal( &self, input: &str, schema: &Schema, ) -> Result<BashVal, ParseError>
Sourcefn rows(&self, input: &str) -> Result<Vec<Vec<String>>, ParseError>
fn rows(&self, input: &str) -> Result<Vec<Vec<String>>, ParseError>
A two-dimensional literal as its rows: ("'a' 'b'" "'c'") →
[["a", "b"], ["c"]]. One dimension needs no codec — see
parse_array.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".