Trait xso::IntoXmlText
source · pub trait IntoXmlText: Sized {
// Required method
fn into_xml_text(self) -> Result<String, Error>;
// Provided method
fn into_optional_xml_text(self) -> Result<Option<String>, Error> { ... }
}
Expand description
Trait to convert a value to an XML text string.
This trait is implemented for many standard library types implementing
std::fmt::Display
. In addition, the following feature flags can enable
more implementations:
jid
:jid::Jid
,jid::BareJid
,jid::FullJid
uuid
:uuid::Uuid
Because of the unfortunate situation as described in FromXmlText
, we
are extremely liberal with accepting optional dependencies for this
purpose. You are very welcome to make merge requests against this crate
adding support for parsing third-party crates.
Required Methods§
sourcefn into_xml_text(self) -> Result<String, Error>
fn into_xml_text(self) -> Result<String, Error>
Convert the value to an XML string in a context where an absent value cannot be represented.
Provided Methods§
sourcefn into_optional_xml_text(self) -> Result<Option<String>, Error>
fn into_optional_xml_text(self) -> Result<Option<String>, Error>
Convert the value to an XML string in a context where an absent value can be represented.
The provided implementation will always return the result of
Self::into_xml_text
wrapped into Some(.)
. By re-implementing
this method, implementors can customize the behaviour for certain
values.
Object Safety§
Implementations on Foreign Types§
source§impl IntoXmlText for IpAddr
impl IntoXmlText for IpAddr
source§impl IntoXmlText for SocketAddr
impl IntoXmlText for SocketAddr
source§impl IntoXmlText for bool
impl IntoXmlText for bool
This provides an implementation compliant with xsd::bool.
source§impl IntoXmlText for f32
impl IntoXmlText for f32
source§impl IntoXmlText for f64
impl IntoXmlText for f64
source§impl IntoXmlText for i8
impl IntoXmlText for i8
source§impl IntoXmlText for i16
impl IntoXmlText for i16
source§impl IntoXmlText for i32
impl IntoXmlText for i32
source§impl IntoXmlText for i64
impl IntoXmlText for i64
source§impl IntoXmlText for i128
impl IntoXmlText for i128
source§impl IntoXmlText for isize
impl IntoXmlText for isize
source§impl IntoXmlText for u8
impl IntoXmlText for u8
source§impl IntoXmlText for u16
impl IntoXmlText for u16
source§impl IntoXmlText for u32
impl IntoXmlText for u32
source§impl IntoXmlText for u64
impl IntoXmlText for u64
source§impl IntoXmlText for u128
impl IntoXmlText for u128
source§impl IntoXmlText for usize
impl IntoXmlText for usize
source§impl IntoXmlText for BareJid
Available on crate feature jid
only.
impl IntoXmlText for BareJid
jid
only.source§impl IntoXmlText for FullJid
Available on crate feature jid
only.
impl IntoXmlText for FullJid
jid
only.source§impl IntoXmlText for Jid
Available on crate feature jid
only.
impl IntoXmlText for Jid
jid
only.source§impl IntoXmlText for String
impl IntoXmlText for String
source§impl IntoXmlText for Ipv4Addr
impl IntoXmlText for Ipv4Addr
source§impl IntoXmlText for Ipv6Addr
impl IntoXmlText for Ipv6Addr
source§impl IntoXmlText for SocketAddrV4
impl IntoXmlText for SocketAddrV4
source§impl IntoXmlText for SocketAddrV6
impl IntoXmlText for SocketAddrV6
source§impl IntoXmlText for Uuid
Available on crate feature uuid
only.
impl IntoXmlText for Uuid
uuid
only.