diff --git a/plume-models/src/safe_string.rs b/plume-models/src/safe_string.rs index 98897434..886e385b 100644 --- a/plume-models/src/safe_string.rs +++ b/plume-models/src/safe_string.rs @@ -101,3 +101,17 @@ impl AsRef 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 { + let val = String::from_form_value(form_value)?; + Ok(SafeString { + value: val, + }) + } +}