pub struct BindInput<'a> {
pub path: &'a HashMap<String, String>,
pub query: &'a HashMap<String, String>,
pub query_multi: Option<&'a HashMap<String, Vec<String>>>,
pub claims: Option<&'a dyn IClaims>,
pub form: Option<&'a MultipartForm>,
pub is_body: bool,
pub is_multipart: bool,
}Expand description
The value providers a generated RequestModel::bind reads from.
Borrowed from the request context: binding never copies the route, query or header maps, and the form is shared through the request’s cached parse.
Fields§
§path: &'a HashMap<String, String>Route parameters captured by the router ({} segments).
query: &'a HashMap<String, String>Query string, last value per key (the compatibility view).
query_multi: Option<&'a HashMap<String, Vec<String>>>Query string, every value per key; None when the host does not
provide multi-value parsing.
claims: Option<&'a dyn IClaims>The authenticated principal, when the request is authenticated.
form: Option<&'a MultipartForm>The parsed multipart/form-data body, when the request is multipart.
is_body: boolWhether the route method is POST, PUT or PATCH.
is_multipart: boolWhether the request declares multipart/form-data.
Implementations§
Source§impl<'a> BindInput<'a>
impl<'a> BindInput<'a>
Sourcepub fn path_list(&self, name: &str) -> Vec<&'a str>
pub fn path_list(&self, name: &str) -> Vec<&'a str>
Every route value for name, comma-separated lists expanded.
A route segment is a single value, but {ids} accepting 1,2,3 is a
convenient way to bind Vec<T> from the path — the same rule query
values follow.
Sourcepub fn query_list(&self, name: &str) -> Vec<&'a str>
pub fn query_list(&self, name: &str) -> Vec<&'a str>
Every query value for name, comma-separated lists expanded.
Sourcepub fn form_one(&self, name: &str) -> Option<&'a str>
pub fn form_one(&self, name: &str) -> Option<&'a str>
The first text part named name in the form.
Sourcepub fn form_list(&self, name: &str) -> Vec<&'a str>
pub fn form_list(&self, name: &str) -> Vec<&'a str>
Every text part named name, comma-separated lists expanded.
Sourcepub fn claim(&self, key: &str) -> Option<&'a str>
pub fn claim(&self, key: &str) -> Option<&'a str>
A claim value by key.
sub / subject resolve to the subject, tenant_id to the tenant
helper, and anything else to the raw claims map.
Sourcepub fn claim_list(&self, key: &str) -> Vec<&'a str>
pub fn claim_list(&self, key: &str) -> Vec<&'a str>
A claim as a list: roles / permissions use their dedicated slots,
anything else is comma-separated.