pub fn save_command<'b, T: Serialize>(
        &mut self,
        value: &DiffCommandRef<'b, T>,
        implicit_exit: bool,
        is_change: bool,
    ) -> Result<(), S::Error> {
        let element_stack = self.element_stack.as_mut().unwrap();
        if !element_stack.is_empty() {
            // flush buffered elements as Enter* commands
            for element in element_stack.drain(0..element_stack.len()) {
                match element {
                    ElementStackEntry::PathElement(element) => self
                        .serializer
                        .serialize_element(&DiffCommandRef::<()>::Enter(element))?,
                    ElementStackEntry::Closure(closure) => (closure)(&mut self.serializer)?,
                };
            }
            self.element_stack_start = 0;
        }
        self.has_changes |= is_change;
        self.implicit_exit_written = implicit_exit;
        self.serializer.serialize_element(value)
    }
/// Stores an arbitrary DiffCommand to be handled by the type.
/// Any custom sequence of DiffCommands must be followed by Exit.
Stores an arbitrary DiffCommand to be handled by the type.
Any custom sequence of DiffCommands must be followed by Exit.
Stores an arbitrary DiffCommand to be handled by the type . Any custom sequence of DiffCommands must be followed by Exit .
pub fn save_command<'b, T: Serialize>(
        &mut self,
        value: &DiffCommandRef<'b, T>,
        implicit_exit: bool,
        is_change: bool,
    ) -> Result<(), S::Error> {
        let element_stack = self.element_stack.as_mut().unwrap();
        if !element_stack.is_empty() {
            // flush buffered elements as Enter* commands
            for element in element_stack.drain(0..element_stack.len()) {
                match element {
                    ElementStackEntry::PathElement(element) => self
                        .serializer
                        .serialize_element(&DiffCommandRef::<()>::Enter(element))?,
                    ElementStackEntry::Closure(closure) => (closure)(&mut self.serializer)?,
                };
            }
            self.element_stack_start = 0;
        }
        self.has_changes |= is_change;
        self.implicit_exit_written = implicit_exit;
        self.serializer.serialize_element(value)
    }
pub fn save_command < ' b , T : Serialize > ( & mut self , value : & DiffCommandRef < ' b , T > , implicit_exit : bool , is_change : bool , ) -> Result < ( ) , S :: Error > { let element_stack = self . element_stack . as_mut ( ) . unwrap ( ) ; if ! element_stack . is_empty ( ) { // flush buffered elements as Enter* commands for element in element_stack . drain ( 0 .. element_stack . len ( ) ) { match element { ElementStackEntry :: PathElement ( element ) => self . serializer . serialize_element ( & DiffCommandRef :: < ( ) > :: Enter ( element ) ) ? , ElementStackEntry :: Closure ( closure ) => ( closure ) ( & mut self . serializer ) ? , } ; } self . element_stack_start = 0 ; } self . has_changes |= is_change ; self . implicit_exit_written = implicit_exit ; self . serializer . serialize_element ( value ) }
Stores an arbitrary DiffCommand to be handled by the type.
Stores an arbitrary DiffCommand to be handled by the type .
&mut self
value
&DiffCommandRef<'b, T>
implicit_exit
bool
is_change
bool