Function serde_dynamo::from_items
source · [−]pub fn from_items<'a, Is, T>(items: Is) -> Result<Vec<T>> where
Is: Into<Items>,
T: Deserialize<'a>,
Expand description
Interpret a Items
as a Vec<T>
.
#[derive(Serialize, Deserialize)]
pub struct User {
id: String,
name: String,
age: u8,
};
// Get documents from DynamoDB
let result = client.scan().table_name("user").send().await?;
// And deserialize them as strongly-typed data structures
if let Some(items) = result.items {
let users: Vec<User> = from_items(items)?;
println!("Got {} users", users.len());
}