fn resolve_recursive<T, U, F>(&mut self, id: MemoId, u: U, f: F) -> Result<T>
        where F: FnOnce(&mut Self, U, Value) -> Result<T>
    {
        // Take the value from the memo while visiting it.  This prevents us
        // from trying to depickle recursive structures, which we can't do
        // because our Values aren't references.
        let (value, mut count) = match self.memo.remove(&id) {
            Some(entry) => entry,
            None => return Err(Error::Syntax(ErrorCode::Recursive)),
        };
        count -= 1;
        if count <= 0 {
            f(self, u, value)
            // No need to put it back.
        } else {
            let result = f(self, u, value.clone());
            self.memo.insert(id, (value, count));
            result
        }
    }
// Resolve memo reference during Value deserializing.
Resolve memo reference during Value deserializing.
Resolve memo reference during Value deserializing .
fn resolve_recursive<T, U, F>(&mut self, id: MemoId, u: U, f: F) -> Result<T>
        where F: FnOnce(&mut Self, U, Value) -> Result<T>
    {
        // Take the value from the memo while visiting it.  This prevents us
        // from trying to depickle recursive structures, which we can't do
        // because our Values aren't references.
        let (value, mut count) = match self.memo.remove(&id) {
            Some(entry) => entry,
            None => return Err(Error::Syntax(ErrorCode::Recursive)),
        };
        count -= 1;
        if count <= 0 {
            f(self, u, value)
            // No need to put it back.
        } else {
            let result = f(self, u, value.clone());
            self.memo.insert(id, (value, count));
            result
        }
    }
fn resolve_recursive < T , U , F > ( & mut self , id : MemoId , u : U , f : F ) -> Result < T > where F : FnOnce ( & mut Self , U , Value ) -> Result < T > { // Take the value from the memo while visiting it.  This prevents us // from trying to depickle recursive structures, which we can't do // because our Values aren't references. let ( value , mut count ) = match self . memo . remove ( & id ) { Some ( entry ) => entry , None => return Err ( Error :: Syntax ( ErrorCode :: Recursive ) ) , } ; count -= 1 ; if count <= 0 { f ( self , u , value ) // No need to put it back. } else { let result = f ( self , u , value . clone ( ) ) ; self . memo . insert ( id , ( value , count ) ) ; result } }
Resolve memo reference during Value deserializing.
Resolve memo reference during Value deserializing .
&mut self
id
MemoId
u
U
f
F
&mut self
id
MemoId
u
U
f
F