I found an answer from Serde issue 891: I should use DeserializeOwned
instead of Deserialize
.
More Related Contents:
- Lifetime error when creating a function that returns a value implementing serde::Deserialize
- Why can’t I store a value and a reference to that value in the same struct?
- What are non-lexical lifetimes?
- Why is a trait not implemented for a type that clearly has it implemented?
- The compiler suggests I add a ‘static lifetime because the parameter type may not live long enough, but I don’t think that’s what I want
- How to transform fields during deserialization using Serde?
- How can I create my own data structure with an iterator that returns mutable references?
- Why does linking lifetimes matter only with mutable references?
- Why is adding a lifetime to a trait with the plus operator (Iterator + ‘a) needed?
- Cannot infer an appropriate lifetime for autoref due to conflicting requirements
- When is it useful to define multiple lifetimes in a struct?
- Lifetime troubles sharing references between threads
- Moved variable still borrowing after calling `drop`?
- What is lifetime elision in very simple terms?
- How can this instance seemingly outlive its own parameter lifetime?
- How do I specify lifetime parameters in an associated type?
- How to operate on 2 mutable slices of a Rust array?
- When returning the outcome of consuming a StdinLock, why was the borrow to stdin retained?
- Why does my variable not live long enough?
- Why is the bound `T: ‘a` required in order to store a reference `&’a T`?
- How can I distinguish between a deserialized field that is missing and one that is null?
- Sharing a struct with trait objects as properties across threads
- Why can’t I return an &str value generated from a String?
- How to implement `serde::Serialize` for a boxed trait object?
- Why does Rust disallow mutable aliasing?
- What’s the difference between using the return statement and omitting the semicolon in Rust?
- How do I serialize an enum without including the name of the enum variant?
- Why can Serde not derive Deserialize for a struct containing only a &Path?
- Extend lifetime of variable
- Why does the Rust compiler request I constrain a generic type parameter’s lifetime (error E0309)?