softprops / dynomite

โšก๐Ÿฆ€ ๐Ÿงจ make your rust types fit DynamoDB and visa versa
https://docs.rs/dynomite/
MIT License
220 stars 53 forks source link

the trait bound `User: From<HashMap<std::string::String, AttributeValue>>` is not satisfied #165

Closed marchese29 closed 3 years ago

marchese29 commented 3 years ago

๐Ÿ› Bug description

When I try to use <Item>::try_from(<Attributes>) as described in all of the online documentation I can find, I get the following compile-time error: "the trait bound User: From<HashMap<std::string::String, AttributeValue>> is not satisfied"

๐Ÿค” Expected Behavior

๐Ÿ‘Ÿ Steps to reproduce

use dynomite::Item;

#[derive(Item, Clone)]
pub struct User {
    #[dynomite(partition_key)]
    pub key: String,
    pub version: u32,
}

let attrs = ...

let user = User::try_from(attrs);

๐ŸŒ Your environment

dynomite version: 0.10.0

rustc version: nightly-x86_64-apple-darwin (default) rustc 1.57.0-nightly (485ced56b 2021-10-07)

Gabotdev commented 7 months ago

Which was your solution?