Skip to content

query string all or none? (query string nested struct) #2877

Answered by robjtede
zzzz465 asked this question in Q&A
Discussion options

You must be logged in to vote

For an all-or-nothing approach, you can use an Option extractor.

#[derive(Serialize, Deserialize, Debug)]
pub struct Data {
    train_id: String,
    departure: String
}

async fn handler(query: Option<web::Query<Data>>) { ... }

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@zzzz465
Comment options

Answer selected by zzzz465
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants