Function serde_dynamo::from_items [−][src]
pub fn from_items<'a, T>(items: Vec<Item>) -> Result<Vec<T>> where
T: Deserialize<'a>,
Interpret an Vec<Item>
as Vec<T>
.
#[derive(Serialize, Deserialize)] pub struct User { id: String, name: String, age: u8, }; // Get documents from DynamoDB let input = ScanInput { table_name: "users".to_string(), ..ScanInput::default() }; let result = client.scan(input).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()); }