fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            EdnElement::Nil => serializer.serialize_none(),
            EdnElement::True => serializer.serialize_bool(true),
            EdnElement::False => serializer.serialize_bool(false),
            EdnElement::String(s) => {
                // Remove leading and trailing double-quote.
                serializer.serialize_str(&s[1..s.len() - 1])
            }
            EdnElement::Symbol(s) => serializer.serialize_str(s),
            EdnElement::Keyword(s) => {
                // Remove trailing colon, then replace dashes with underscores.
                serializer.serialize_str(&s.trim_start_matches(":").replace("-", "_"))
            }
            EdnElement::Integer(i) => serializer.serialize_i64(*i),
            EdnElement::Float(f) => serializer.serialize_f64(*f),
            EdnElement::List(elements)
            | EdnElement::Vector(elements)
            | EdnElement::Set(elements) => {
                let mut seq = serializer.serialize_seq(Some(elements.len()))?;
                for e in elements {
                    seq.serialize_element(e)?;
                }
                seq.end()
            }
            EdnElement::Map(pairs) => {
                let mut map = serializer.serialize_map(Some(pairs.len()))?;
                for p in pairs {
                    map.serialize_entry(&p.0, &p.1)?;
                }
                map.end()
            }
        }
    }
/// Serializes an EDN element.
///
/// This serialization is lossy and cannot be reversed.
/// Symbols and keywords are serialized to strings.
/// Lists, vectors, and sets are serialized to sequences.
Serializes an EDN element.
This serialization is lossy and cannot be reversed.
Symbols and keywords are serialized to strings.
Lists, vectors, and sets are serialized to sequences.
Serializes an EDN element . This serialization is lossy and cannot be reversed . Symbols and keywords are serialized to strings . Lists vectors and sets are serialized to sequences .
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            EdnElement::Nil => serializer.serialize_none(),
            EdnElement::True => serializer.serialize_bool(true),
            EdnElement::False => serializer.serialize_bool(false),
            EdnElement::String(s) => {
                // Remove leading and trailing double-quote.
                serializer.serialize_str(&s[1..s.len() - 1])
            }
            EdnElement::Symbol(s) => serializer.serialize_str(s),
            EdnElement::Keyword(s) => {
                // Remove trailing colon, then replace dashes with underscores.
                serializer.serialize_str(&s.trim_start_matches(":").replace("-", "_"))
            }
            EdnElement::Integer(i) => serializer.serialize_i64(*i),
            EdnElement::Float(f) => serializer.serialize_f64(*f),
            EdnElement::List(elements)
            | EdnElement::Vector(elements)
            | EdnElement::Set(elements) => {
                let mut seq = serializer.serialize_seq(Some(elements.len()))?;
                for e in elements {
                    seq.serialize_element(e)?;
                }
                seq.end()
            }
            EdnElement::Map(pairs) => {
                let mut map = serializer.serialize_map(Some(pairs.len()))?;
                for p in pairs {
                    map.serialize_entry(&p.0, &p.1)?;
                }
                map.end()
            }
        }
    }
fn serialize < S > ( & self , serializer : S ) -> Result < S :: Ok , S :: Error > where S : Serializer , { match self { EdnElement :: Nil => serializer . serialize_none ( ) , EdnElement :: True => serializer . serialize_bool ( true ) , EdnElement :: False => serializer . serialize_bool ( false ) , EdnElement :: String ( s ) => { // Remove leading and trailing double-quote. serializer . serialize_str ( & s [ 1 .. s . len ( ) - 1 ] ) } EdnElement :: Symbol ( s ) => serializer . serialize_str ( s ) , EdnElement :: Keyword ( s ) => { // Remove trailing colon, then replace dashes with underscores. serializer . serialize_str ( & s . trim_start_matches ( " " ) . replace ( " " , " " ) ) } EdnElement :: Integer ( i ) => serializer . serialize_i64 ( * i ) , EdnElement :: Float ( f ) => serializer . serialize_f64 ( * f ) , EdnElement :: List ( elements ) | EdnElement :: Vector ( elements ) | EdnElement :: Set ( elements ) => { let mut seq = serializer . serialize_seq ( Some ( elements . len ( ) ) ) ? ; for e in elements { seq . serialize_element ( e ) ? ; } seq . end ( ) } EdnElement :: Map ( pairs ) => { let mut map = serializer . serialize_map ( Some ( pairs . len ( ) ) ) ? ; for p in pairs { map . serialize_entry ( & p . 0 , & p . 1 ) ? ; } map . end ( ) } } }
Serializes an EDN element.
Serializes an EDN element .
&self
serializer
S
&self
serializer
S