xso

Trait FromXmlText

Source
pub trait FromXmlText: Sized {
    // Required method
    fn from_xml_text(data: String) -> Result<Self, Error>;
}
Expand description

Trait allowing to convert XML text to a value.

This trait is similar to core::str::FromStr, however, due to restrictions imposed by the orphan rule, a separate trait is needed. Implementations for many standard library types are available. In addition, the following feature flags can enable more implementations:

  • jid: jid::Jid, jid::BareJid, jid::FullJid
  • uuid: uuid::Uuid

Because of this unfortunate situation, 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§

Source

fn from_xml_text(data: String) -> Result<Self, Error>

Convert the given XML text to a value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromXmlText for IpAddr

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::net::IpAddr from XML text via FromStr.

Source§

impl FromXmlText for SocketAddr

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::net::SocketAddr from XML text via FromStr.

Source§

impl FromXmlText for bool

This provides an implementation compliant with xsd::bool.

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse a boolean from XML text.

The values "1" and "true" are considered true. The values "0" and "false" are considered false. Any other value is invalid and will return an error.

Source§

impl FromXmlText for char

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse char from XML text via FromStr.

Source§

impl FromXmlText for f32

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse f32 from XML text via FromStr.

Source§

impl FromXmlText for f64

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse f64 from XML text via FromStr.

Source§

impl FromXmlText for i8

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse i8 from XML text via FromStr.

Source§

impl FromXmlText for i16

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse i16 from XML text via FromStr.

Source§

impl FromXmlText for i32

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse i32 from XML text via FromStr.

Source§

impl FromXmlText for i64

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse i64 from XML text via FromStr.

Source§

impl FromXmlText for i128

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse i128 from XML text via FromStr.

Source§

impl FromXmlText for isize

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse isize from XML text via FromStr.

Source§

impl FromXmlText for u8

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse u8 from XML text via FromStr.

Source§

impl FromXmlText for u16

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse u16 from XML text via FromStr.

Source§

impl FromXmlText for u32

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse u32 from XML text via FromStr.

Source§

impl FromXmlText for u64

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse u64 from XML text via FromStr.

Source§

impl FromXmlText for u128

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse u128 from XML text via FromStr.

Source§

impl FromXmlText for usize

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse usize from XML text via FromStr.

Source§

impl FromXmlText for DomainPart

Available on crate feature jid only.
Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse jid::DomainPart from XML text via FromStr.

Source§

impl FromXmlText for NodePart

Available on crate feature jid only.
Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse jid::NodePart from XML text via FromStr.

Source§

impl FromXmlText for ResourcePart

Available on crate feature jid only.
Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse jid::ResourcePart from XML text via FromStr.

Source§

impl FromXmlText for BareJid

Available on crate feature jid only.
Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse jid::BareJid from XML text via FromStr.

Source§

impl FromXmlText for FullJid

Available on crate feature jid only.
Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse jid::FullJid from XML text via FromStr.

Source§

impl FromXmlText for Jid

Available on crate feature jid only.
Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse jid::Jid from XML text via FromStr.

Source§

impl FromXmlText for String

Source§

fn from_xml_text(data: String) -> Result<Self, Error>

 Return the string unchanged.

Source§

impl FromXmlText for Ipv4Addr

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::net::Ipv4Addr from XML text via FromStr.

Source§

impl FromXmlText for Ipv6Addr

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::net::Ipv6Addr from XML text via FromStr.

Source§

impl FromXmlText for SocketAddrV4

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::net::SocketAddrV4 from XML text via FromStr.

Source§

impl FromXmlText for SocketAddrV6

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::net::SocketAddrV6 from XML text via FromStr.

Source§

impl FromXmlText for Uuid

Available on crate feature uuid only.
Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse uuid::Uuid from XML text via FromStr.

Source§

impl FromXmlText for NonZeroI8

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroI8 from XML text via FromStr.

Source§

impl FromXmlText for NonZeroI16

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroI16 from XML text via FromStr.

Source§

impl FromXmlText for NonZeroI32

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroI32 from XML text via FromStr.

Source§

impl FromXmlText for NonZeroI64

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroI64 from XML text via FromStr.

Source§

impl FromXmlText for NonZeroI128

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroI128 from XML text via FromStr.

Source§

impl FromXmlText for NonZeroIsize

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroIsize from XML text via FromStr.

Source§

impl FromXmlText for NonZeroU8

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroU8 from XML text via FromStr.

Source§

impl FromXmlText for NonZeroU16

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroU16 from XML text via FromStr.

Source§

impl FromXmlText for NonZeroU32

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroU32 from XML text via FromStr.

Source§

impl FromXmlText for NonZeroU64

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroU64 from XML text via FromStr.

Source§

impl FromXmlText for NonZeroU128

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroU128 from XML text via FromStr.

Source§

impl FromXmlText for NonZeroUsize

Source§

fn from_xml_text(s: String) -> Result<Self, Error>

Parse core::num::NonZeroUsize from XML text via FromStr.

Source§

impl<T: FromXmlText> FromXmlText for Option<T>

Source§

fn from_xml_text(data: String) -> Result<Self, Error>

Return a Some containing the parsed value.

Source§

impl<T: FromXmlText> FromXmlText for Box<T>

Source§

fn from_xml_text(data: String) -> Result<Self, Error>

Return a Box containing the parsed value.

Source§

impl<T: FromXmlText, B: ToOwned<Owned = T>> FromXmlText for Cow<'_, B>

Source§

fn from_xml_text(data: String) -> Result<Self, Error>

Return a Cow::Owned containing the parsed value.

Implementors§