Skip to content

to_item: the trait bound !: std::convert::From<serde_dynamo::Item> is not satisfied #107

@wilfredjonathanjames

Description

@wilfredjonathanjames

serde_dynamo@4.3.0

Using the enum example given here, I'm seeing a trait bound error on to_item:

1. the trait bound `!: std::convert::From<serde_dynamo::Item>` is not satisfied
  the trait `std::convert::From<serde_dynamo::Item>` is not implemented for `!` [E0277]

The same thing when using the example given here.

Using the 2021 edition yields a slightly different error:

1. the trait bound `(): std::convert::From<serde_dynamo::Item>` is not satisfied
   the trait `From<serde_dynamo::Item>` is not implemented for `()`
   but trait `From<aws_lc_rs::error::Unspecified>` is implemented for it
   for that trait implementation, expected `aws_lc_rs::error::Unspecified`, found `serde_dynamo::Item` [E0277]

Either way, I'm not sure how to proceed. My own code has the same issue as the examples I have tried.

[Edit]
I've answered my own question. the item must be given the type serde_dynamo::Item.

  let item: Item = to_item(data)?;

Leaving open because it seems the docs need updating.

[Edit Edit]
It turns out the correct type is not Item but

HashMap<String, AttributeValue>

And I needed to use the feature flag aws-sdk-dynamodb+1

Would love it if someone could point out where this is mentioned in the documentation.

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