pub struct FormFields { /* private fields */ }Expand description
The decoded fields of one submission, in the order they were sent.
Implementations§
Source§impl FormFields
impl FormFields
Sourcepub fn parse(encoded: &str) -> Self
pub fn parse(encoded: &str) -> Self
Decode key=value&key2=value2, as the reference client encodes it:
+ for a space and %XX for anything else outside the unreserved set.
Malformed input is decoded as far as it makes sense rather than
rejected: a stray % is kept literally, and a pair with no = becomes
a field with an empty value. A submission is not a place to be clever —
the handler decides what it requires, and every value is untrusted
either way.
Sourcepub fn get(&self, name: &str) -> Option<&str>
pub fn get(&self, name: &str) -> Option<&str>
The first value sent under name.
First rather than last, and stated here because the choice is only
invisible until two values disagree. A handler that cares which one it
got should use FormFields::all and decide deliberately.
Sourcepub fn all<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a str> + 'a
pub fn all<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a str> + 'a
Every value sent under name, in order.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for FormFields
impl Clone for FormFields
Source§impl Debug for FormFields
impl Debug for FormFields
Auto Trait Implementations§
impl Freeze for FormFields
impl RefUnwindSafe for FormFields
impl Send for FormFields
impl Sync for FormFields
impl Unpin for FormFields
impl UnsafeUnpin for FormFields
impl UnwindSafe for FormFields
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more