webdav_xml/elements/
responsedescription.rs1use bytestring::ByteString;
6
7use crate::{Element, Error, Value, DAV_NAMESPACE, DAV_PREFIX};
8
9#[derive(Clone, Debug, PartialEq)]
11pub struct ResponseDescription(pub ByteString);
12
13impl Element for ResponseDescription {
14 const NAMESPACE: &'static str = DAV_NAMESPACE;
15 const PREFIX: &'static str = DAV_PREFIX;
16 const LOCAL_NAME: &'static str = "responsedescription";
17}
18
19impl TryFrom<&Value> for ResponseDescription {
20 type Error = Error;
21
22 fn try_from(value: &Value) -> Result<Self, Self::Error> {
23 Ok(Self(value.to_str()?.to_owned()))
24 }
25}
26
27impl From<ResponseDescription> for Value {
28 fn from(ResponseDescription(s): ResponseDescription) -> Value {
29 Value::Text(s)
30 }
31}
32
33impl<S: Into<ByteString>> From<S> for ResponseDescription {
34 fn from(s: S) -> Self {
35 ResponseDescription(s.into())
36 }
37}