add implementation for FromFormValue for SafeString
thanks again to @pwoolcoc for this!
This commit is contained in:
parent
65e213309b
commit
0897088aa5
@ -101,3 +101,17 @@ impl AsRef<str> for SafeString {
|
||||
&self.value
|
||||
}
|
||||
}
|
||||
|
||||
use rocket::request::FromFormValue;
|
||||
use rocket::http::RawStr;
|
||||
|
||||
impl<'v> FromFormValue<'v> for SafeString {
|
||||
type Error = &'v RawStr;
|
||||
|
||||
fn from_form_value(form_value: &'v RawStr) -> Result<SafeString, &'v RawStr> {
|
||||
let val = String::from_form_value(form_value)?;
|
||||
Ok(SafeString {
|
||||
value: val,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user