fn maybe_push_key(
        &mut self,
        stack_element: Option<StackElement>,
    ) -> Result<Option<String>, Error> {
        match stack_element {
            Some(StackElement::Key(key)) => {
                if self.kb.kp_segments_len() == 1 && key == "_id" {
                    return Err(Error::Shred(
                        "Expected string for `_id` field, got another type".to_string(),
                    ));
                } else {
                    // Pop the dummy object that makes ObjectEnd happy
                    // or the previous object key
                    self.kb.pop_object_key();
                    self.kb.push_object_key(key);
                    *self.object_keys_indexed.last_mut().unwrap() = true;
                }
                Ok(Some(key.to_string()))
            }
            _ => Ok(None),
        }
    }
// If we are inside an object we need to push the key to the key builder
// Don't push them if they are reserved fields (starting with underscore)
// It is called when the value is an array or object. If it is a primitive type, then
// `extract_key` is called.
If we are inside an object we need to push the key to the key builder
Don't push them if they are reserved fields (starting with underscore)
It is called when the value is an array or object. If it is a primitive type, then
`extract_key` is called.
If we are inside an object we need to push the key to the key builder Don ' t push them if they are reserved fields ( starting with underscore ) It is called when the value is an array or object . If it is a primitive type then ` extract_key ` is called .
fn maybe_push_key(
        &mut self,
        stack_element: Option<StackElement>,
    ) -> Result<Option<String>, Error> {
        match stack_element {
            Some(StackElement::Key(key)) => {
                if self.kb.kp_segments_len() == 1 && key == "_id" {
                    return Err(Error::Shred(
                        "Expected string for `_id` field, got another type".to_string(),
                    ));
                } else {
                    // Pop the dummy object that makes ObjectEnd happy
                    // or the previous object key
                    self.kb.pop_object_key();
                    self.kb.push_object_key(key);
                    *self.object_keys_indexed.last_mut().unwrap() = true;
                }
                Ok(Some(key.to_string()))
            }
            _ => Ok(None),
        }
    }
fn maybe_push_key ( & mut self , stack_element : Option < StackElement > , ) -> Result < Option < String > , Error > { match stack_element { Some ( StackElement :: Key ( key ) ) => { if self . kb . kp_segments_len ( ) == 1 && key == " " { return Err ( Error :: Shred ( " " . to_string ( ) , ) ) ; } else { // Pop the dummy object that makes ObjectEnd happy // or the previous object key self . kb . pop_object_key ( ) ; self . kb . push_object_key ( key ) ; * self . object_keys_indexed . last_mut ( ) . unwrap ( ) = true ; } Ok ( Some ( key . to_string ( ) ) ) } _ => Ok ( None ) , } }
If we are inside an object we need to push the key to the key builder
Don't push them if they are reserved fields (starting with underscore)
It is called when the value is an array or object.
If we are inside an object we need to push the key to the key builder Don ' t push them if they are reserved fields ( starting with underscore ) It is called when the value is an array or object .
&mut self
stack_element
Option<StackElement>
&mut self
stack_element
Option<StackElement>