pub fn display<W: Write>(
        &self,
        formatter: &mut W,
        use_array_brackets: bool,
    ) -> std::fmt::Result {
        match self {
            Value::Literal(lit) => display_lit(formatter, lit),
            Value::Array(array) => {
                let result = array
                    .iter()
                    .map(|s| lit_to_string(s))
                    .collect::<Vec<String>>();

                if use_array_brackets {
                    write!(formatter, "[{}]", result.join(", "))
                } else {
                    write!(formatter, "{}", result.join(", "))
                }
            }
        }
    }
/// Writes a `String` representation of this value using the given `Write`.
///
/// # Arguments
/// - `formatter` : The formatter used to write the data.
/// - `use_array_brackets` : Wraps the arrays using brackets: `[1,2,3]`.
Writes a `String` representation of this value using the given `Write`.
Writes a ` String ` representation of this value using the given ` Write ` .
pub fn display<W: Write>(
        &self,
        formatter: &mut W,
        use_array_brackets: bool,
    ) -> std::fmt::Result {
        match self {
            Value::Literal(lit) => display_lit(formatter, lit),
            Value::Array(array) => {
                let result = array
                    .iter()
                    .map(|s| lit_to_string(s))
                    .collect::<Vec<String>>();
                if use_array_brackets {
                    write!(formatter, "[{}]", result.join(", "))
                } else {
                    write!(formatter, "{}", result.join(", "))
                }
            }
        }
    }
pub fn display < W : Write > ( & self , formatter : & mut W , use_array_brackets : bool , ) -> std :: fmt :: Result { match self { Value :: Literal ( lit ) => display_lit ( formatter , lit ) , Value :: Array ( array ) => { let result = array . iter ( ) . map ( | s | lit_to_string ( s ) ) . collect :: < Vec < String > > ( ) ; if use_array_brackets { write ! ( formatter " " result join ( " " ) ) } else { write ! ( formatter " " result join ( " " ) ) } } } }
Writes a `String` representation of this value using the given `Write`.
Writes a ` String ` representation of this value using the given ` Write ` .
&self
formatter
&mut W
use_array_brackets
bool
&self
formatter
&mut W
: The formatter used to write the data.
: The formatter used to write the data .
use_array_brackets
bool
: Wraps the arrays using brackets: `[1,2,3]`.
: Wraps the arrays using brackets : ` [ 1 2 3 ] ` .