impl Serialize for ContentDisposition
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
c3f21813ca
commit
b57e03e342
@ -6,6 +6,7 @@ use http::header::{HeaderValue, InvalidHeaderValue};
|
|||||||
use ruma_macros::{
|
use ruma_macros::{
|
||||||
AsRefStr, AsStrAsRefStr, DebugAsRefStr, DisplayAsRefStr, OrdAsRefStr, PartialOrdAsRefStr,
|
AsRefStr, AsStrAsRefStr, DebugAsRefStr, DisplayAsRefStr, OrdAsRefStr, PartialOrdAsRefStr,
|
||||||
};
|
};
|
||||||
|
use serde::{Serialize, Serializer};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
is_tchar, is_token, quote_ascii_string_if_required, rfc8187, sanitize_for_ascii_quoted_string,
|
is_tchar, is_token, quote_ascii_string_if_required, rfc8187, sanitize_for_ascii_quoted_string,
|
||||||
@ -71,6 +72,12 @@ impl fmt::Display for ContentDisposition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Serialize for ContentDisposition {
|
||||||
|
fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
|
||||||
|
s.serialize_str(self.to_string().as_str())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl TryFrom<&ContentDisposition> for HeaderValue {
|
impl TryFrom<&ContentDisposition> for HeaderValue {
|
||||||
type Error = InvalidHeaderValue;
|
type Error = InvalidHeaderValue;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user