mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-14 07:51:01 +00:00
add implementation for FromFormValue for SafeString
thanks again to @pwoolcoc for this!
This commit is contained in:
parent
65e213309b
commit
0897088aa5
1 changed files with 14 additions and 0 deletions
|
@ -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 a new issue