I am trying to serialize a struct using derive
:
#[derive(Serialize)]
struct MyStruct {
txt: ResolveResult<TxtLookup>
}
ResolveResult
and TxtLookup
are from trust-dns-resolver 0.20.3. I'm using serde 1.0 for the serialization.
I am getting the following error:
error[E0277]: the trait bound `TxtLookup: Serialize` is not satisfied
--> src/main.rs:17:5
|
17 | txt: ResolveResult<TxtLookup>
| ^^^ the trait `Serialize` is not implemented for `TxtLookup`
|
= note: required because of the requirements on the impl of `Serialize` for `std::result::Result<TxtLookup, ResolveError>`
= note: required by `_::_serde::ser::SerializeStruct::serialize_field`
error[E0277]: the trait bound `ResolveError: Serialize` is not satisfied
--> src/main.rs:17:5
|
17 | txt: ResolveResult<TxtLookup>
| ^^^ the trait `Serialize` is not implemented for `ResolveError`
|
= note: required because of the requirements on the impl of `Serialize` for `std::result::Result<TxtLookup, ResolveError>`
= note: required by `_::_serde::ser::SerializeStruct::serialize_field`
How do I implement serialization for TxtLookup
and ResolveError
? I am new to Rust so its difficult to comprehend.