Skip to content

Deserialization fails for Secp256k1Scalar #180

Open
@ssantos21

Description

@ssantos21

I'm trying to deserialize a String to Secp256k1Scalar, but I am getting the error error[E0277]: the trait bound "Secp256k1Scalar: Deserialize<'_>" is not satisfied, as shown below.

The code is:

let s2: Secp256k1Scalar = serde_json::from_str(&text).unwrap();

How can I deserialize a String to Secp256k1Scalar ?

error[E0277]: the trait bound `Secp256k1Scalar: Deserialize<'_>` is not satisfied
    --> server/src/protocol/ecdsa.rs:134:32
     |
134  |                     Some(s) => serde_json::from_str(&s).unwrap(),
     |                                ^^^^^^^^^^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `Secp256k1Scalar`
     |
     = help: the following other types implement trait `Deserialize<'de>`:
               &'a RawStr
               &'a UncasedStr
               &'a [u8]
               &'a rocket::form::name::Key
               &'a rocket::form::name::Name
               &'a serde_bytes::bytes::Bytes
               &'a std::path::Path
               &'a str
             and 459 others
note: required by a bound in `serde_json::from_str`
    --> /home/node/.cargo/registry/src/g.yxqyang.asia-1ecc6299db9ec823/serde_json-1.0.99/src/de.rs:2603:8
     |
2603 |     T: de::Deserialize<'a>,
     |        ^^^^^^^^^^^^^^^^^^^ required by this bound in `from_str`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions