pub struct LinkedArr;Expand description
A group is prefixed by its width — the full inner word stream, nested prefixes included — exactly where its elements are themselves groups, since a scalar is already one bash word.
| value | words |
|---|---|
[a, b] | a b |
[[a,b],[c,d,e]] | 2 a b 3 c d e |
[[[a,b],[c]]] | 5 2 a b 1 c |
[[[a,b]],[[c]]] | 3 2 a b 2 1 c |
The width prefix is what lets bash walk the stream with shift
alone, so a reader needs no quoting rules of its own.
Trait Implementations§
Source§impl BashCodec for LinkedArr
impl BashCodec for LinkedArr
Source§fn emit(&self, val: &BashVal) -> Vec<String>
fn emit(&self, val: &BashVal) -> Vec<String>
The value’s own depth decides the encoding, so there is nothing to
disagree with and nothing to fail.
Source§fn parse(
&self,
words: &[String],
schema: &Schema,
) -> Result<BashVal, ParseError>
fn parse( &self, words: &[String], schema: &Schema, ) -> Result<BashVal, ParseError>
A
Schema says how many layers of quoting to peel, which the text
alone does not.Source§fn 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>
Source§fn 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.Auto Trait Implementations§
impl Freeze for LinkedArr
impl RefUnwindSafe for LinkedArr
impl Send for LinkedArr
impl Sync for LinkedArr
impl Unpin for LinkedArr
impl UnsafeUnpin for LinkedArr
impl UnwindSafe for LinkedArr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more