Struct rocket::request::FormItem [−][src]
Expand description
A form items returned by the FormItems
iterator.
Fields
raw: &'f RawStr
The full, nonempty string for the item, not including &
delimiters.
key: &'f RawStr
The key for the item, which may be empty if value
is nonempty.
Note: The key is not URL decoded. To URL decode the raw strings,
use the RawStr::url_decode()
method or access key-value pairs with
key_value_decoded()
.
value: &'f RawStr
The value for the item, which may be empty if key
is nonempty.
Note: The value is not URL decoded. To URL decode the raw strings,
use the RawStr::url_decode()
method or access key-value pairs with
key_value_decoded()
.
Implementations
Extracts the raw key
and value
as a tuple.
This is equivalent to (item.key, item.value)
.
Example
use rocket::request::FormItem;
let item = FormItem {
raw: "hello=%2C+world%21".into(),
key: "hello".into(),
value: "%2C+world%21".into(),
};
let (key, value) = item.key_value();
assert_eq!(key, "hello");
assert_eq!(value, "%2C+world%21");
Extracts and lossy URL decodes the key
and value
as a tuple.
This is equivalent to (item.key.url_decode_lossy(), item.value.url_decode_lossy)
.
Example
use rocket::request::FormItem;
let item = FormItem {
raw: "hello=%2C+world%21".into(),
key: "hello".into(),
value: "%2C+world%21".into(),
};
let (key, value) = item.key_value_decoded();
assert_eq!(key, "hello");
assert_eq!(value, ", world!");
Extracts raw
and the raw key
and value
as a triple.
This is equivalent to (item.raw, item.key, item.value)
.
Example
use rocket::request::FormItem;
let item = FormItem {
raw: "hello=%2C+world%21".into(),
key: "hello".into(),
value: "%2C+world%21".into(),
};
let (raw, key, value) = item.explode();
assert_eq!(raw, "hello=%2C+world%21");
assert_eq!(key, "hello");
assert_eq!(value, "%2C+world%21");
Trait Implementations
Auto Trait Implementations
impl<'f> RefUnwindSafe for FormItem<'f>
impl<'f> UnwindSafe for FormItem<'f>
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.