fn add_quoted_string(&mut self, quote: &str, captured: Option<&str>) -> Result<(), Error> {
        match captured {
            Some(unquoted) => {
                if self.is_in_object()
                    && !self.with_object(|object| object.has_pending_property())?
                {
                    let captured = self.colon_capturer.capture(self.remaining);
                    if self.consume_if_matched(captured) {
                        if matches_unquoted_property_name(&unquoted) {
                            self.set_pending_property(unquoted)
                        } else {
                            self.set_pending_property(&format!("{}{}{}", quote, &unquoted, quote))
                        }
                    } else {
                        return Err(self.error("Property name separator (:) missing"));
                    }
                } else {
                    let comments = self.take_pending_comments()?;
                    self.add_value(Primitive::new(
                        format!("{}{}{}", quote, &unquoted, quote),
                        comments,
                    ))
                }
            }
            None => return Err(self.error("Unclosed string")),
        }
    }
/// Adds a primitive string value or quoted property name, depending on the current context.
///
/// For property names that meet the requirements for unquoted property names, the unnecessary
/// quotes are removed; otherwise, the original quotes are retained since the content of the
/// string may depend on the type of quote. For instance:
///
/// ```json
///   'JSON string "with double quotes" wrapped in single quotes'
/// ```
///
/// As long as the single quotes are restored as-is (and not replaced with double-quotes)
/// the formatter can restore the original representation of the string without additional
/// (and perhaps less-readable) escaping of internal quotes.
Adds a primitive string value or quoted property name, depending on the current context.
For property names that meet the requirements for unquoted property names, the unnecessary
quotes are removed; otherwise, the original quotes are retained since the content of the
string may depend on the type of quote. For instance.



As long as the single quotes are restored as-is (and not replaced with double-quotes)
the formatter can restore the original representation of the string without additional
(and perhaps less-readable) escaping of internal quotes.
Adds a primitive string value or quoted property name depending on the current context . For property names that meet the requirements for unquoted property names the unnecessary quotes are removed ; otherwise the original quotes are retained since the content of the string may depend on the type of quote . For instance . As long as the single quotes are restored as - is ( and not replaced with double - quotes ) the formatter can restore the original representation of the string without additional ( and perhaps less - readable ) escaping of internal quotes .
fn add_quoted_string(&mut self, quote: &str, captured: Option<&str>) -> Result<(), Error> {
        match captured {
            Some(unquoted) => {
                if self.is_in_object()
                    && !self.with_object(|object| object.has_pending_property())?
                {
                    let captured = self.colon_capturer.capture(self.remaining);
                    if self.consume_if_matched(captured) {
                        if matches_unquoted_property_name(&unquoted) {
                            self.set_pending_property(unquoted)
                        } else {
                            self.set_pending_property(&format!("{}{}{}", quote, &unquoted, quote))
                        }
                    } else {
                        return Err(self.error("Property name separator (:) missing"));
                    }
                } else {
                    let comments = self.take_pending_comments()?;
                    self.add_value(Primitive::new(
                        format!("{}{}{}", quote, &unquoted, quote),
                        comments,
                    ))
                }
            }
            None => return Err(self.error("Unclosed string")),
        }
    }
fn add_quoted_string ( & mut self , quote : & str , captured : Option < & str > ) -> Result < ( ) , Error > { match captured { Some ( unquoted ) => { if self . is_in_object ( ) && ! self . with_object ( | object | object . has_pending_property ( ) ) ? { let captured = self . colon_capturer . capture ( self . remaining ) ; if self . consume_if_matched ( captured ) { if matches_unquoted_property_name ( & unquoted ) { self . set_pending_property ( unquoted ) } else { self . set_pending_property ( & format ! ( " " quote unquoted quote ) ) } } else { return Err ( self . error ( " " ) ) ; } } else { let comments = self . take_pending_comments ( ) ? ; self . add_value ( Primitive :: new ( format ! ( " " quote unquoted quote ) , comments , ) ) } } None => return Err ( self . error ( " " ) ) , } }
Adds a primitive string value or quoted property name, depending on the current context.
Adds a primitive string value or quoted property name depending on the current context .
&mut self
quote
&str
captured
Option<&str>
&mut self
quote
&str
captured
Option<&str>