Skip to main content

LinkedArr

Struct LinkedArr 

Source
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.

valuewords
[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

Source§

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>

A Schema says how many layers of quoting to peel, which the text alone does not.
Source§

fn emit_literal(&self, val: &BashVal) -> String

A complete bash array literal: (w1 w2 …), each scalar single-quoted.
Source§

fn parse_literal( &self, input: &str, schema: &Schema, ) -> Result<BashVal, ParseError>

Source§

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.