Function serde_dynamo::to_item[][src]

pub fn to_item<T>(value: T) -> Result<Item> where
    T: Serialize

Convert a T into an Item which is rusoto_dynamodb’s representation of a DynamoDb 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!
let input = PutItemInput {
    table_name: "users".to_string(),
    item: item,