Usage of Vec in request #2572
-
Hi, I want to send an array of a certain struct to the interface. I can't implement fromdata on vec cause fromdata is defined outside my package. Is there an easy way to use Vec here?
Kind regards, An old man |
Beta Was this translation helpful? Give feedback.
Answered by
SergioBenitez
Jul 5, 2023
Replies: 1 comment
-
Yes, but you need to specify the format. If it's JSON, do: #[patch("/rapport", data = "<rapport>")]
fn update_rapport(conn: &State<Connection>, rapport: Json<Vec<Rapport>>) { .. } If it's a form, do: #[patch("/rapport", data = "<rapport>")]
fn update_rapport(conn: &State<Connection>, rapport: Form<Vec<Rapport>>) { .. } And so on. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
SergioBenitez
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, but you need to specify the format. If it's JSON, do:
If it's a form, do:
And so on.