Function serde_dynamo::to_item

source ·
pub fn to_item<T, I>(value: T) -> Result<I>
where T: Serialize, I: From<Item>,
Expand description

Convert a T into an Item.

This is frequently used when serializing an entire data structure to be sent to DynamoDB.

#[derive(Serialize, Deserialize)]
pub struct User {
    id: String,
    name: String,
    age: u8,

// Create a user
let user = User {
    id: "fSsgVtal8TpP".to_string(),
    name: "Arthur Dent".to_string(),
    age: 42,

// Turn it into an item that rusoto understands
let item = to_item(user)?;

// And write it!