Skip to content

How to use the Rust API with iterator? #3257

Closed Answered by jackhuang78
jackhuang78 asked this question in Q&A
Discussion options

You must be logged in to vote

I seem to have stumble upon a solution:

  let created: Vec<Vec<Person>> =
    futures::future::try_join_all(person.iter().map(
      |p: &Person| db.create("person").content(p).into_future(),
    ))
    .await?;

  let created: Vec<Person> = created.into_iter().flatten().collect();

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jackhuang78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant