xso: Use core instead of std wherever possible
This commit is contained in:
parent
1828fde78c
commit
f318dd460d
5 changed files with 25 additions and 29 deletions
|
@ -180,7 +180,7 @@ The `attribute` meta also supports a shorthand syntax,
|
|||
otherwise).
|
||||
|
||||
If `default` is specified and the attribute is absent in the source, the value
|
||||
is generated using [`std::default::Default`], requiring the field type to
|
||||
is generated using [`core::default::Default`], requiring the field type to
|
||||
implement the `Default` trait for a `FromXml` derivation. `default` has no
|
||||
influence on `AsXml`.
|
||||
|
||||
|
@ -239,14 +239,14 @@ the field's type must implement [`FromXml`] in order to derive `FromXml` and
|
|||
[`AsXml`] in order to derive `AsXml`.
|
||||
|
||||
When parsing a collection (with `n = ..`), the field's type must implement
|
||||
[`IntoIterator<Item = T>`][`std::iter::IntoIterator`], where `T` must
|
||||
[`IntoIterator<Item = T>`][`core::iter::IntoIterator`], where `T` must
|
||||
implement [`FromXml`] in order to derive `FromXml` and [`AsXml`] in order to
|
||||
derive `AsXml`. In addition, the field's type must implement
|
||||
[`Extend<T>`][`std::iter::Extend`] to derive `FromXml` and the field's
|
||||
[`Extend<T>`][`core::iter::Extend`] to derive `FromXml` and the field's
|
||||
reference type must implement `IntoIterator<Item = &'_ T>` to derive `AsXml`.
|
||||
|
||||
If `default` is specified and the child is absent in the source, the value
|
||||
is generated using [`std::default::Default`], requiring the field type to
|
||||
is generated using [`core::default::Default`], requiring the field type to
|
||||
implement the `Default` trait for a `FromXml` derivation. `default` has no
|
||||
influence on `AsXml`. Combining `default` and `n` where `n` is not set to `1`
|
||||
is not supported and will cause a compile-time error.
|
||||
|
|
|
@ -233,7 +233,7 @@ impl<T: FromXml> FromXml for Box<T> {
|
|||
|
||||
/// Trait allowing to convert XML text to a value.
|
||||
///
|
||||
/// This trait is similar to [`std::str::FromStr`], however, due to
|
||||
/// 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:
|
||||
|
@ -281,7 +281,7 @@ impl<T: FromXmlText> FromXmlText for Box<T> {
|
|||
/// 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
|
||||
/// [`core::fmt::Display`]. In addition, the following feature flags can enable
|
||||
/// more implementations:
|
||||
///
|
||||
/// - `jid`: `jid::Jid`, `jid::BareJid`, `jid::FullJid`
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
use core::marker::PhantomData;
|
||||
use std::borrow::Cow;
|
||||
use std::marker::PhantomData;
|
||||
use std::vec::IntoIter;
|
||||
|
||||
use minidom::{Element, Node};
|
||||
|
|
|
@ -281,8 +281,6 @@ impl<'x, I: Iterator<Item = Result<Item<'x>, crate::error::Error>>> Iterator for
|
|||
|
||||
#[cfg(all(test, feature = "minidom"))]
|
||||
mod tests_minidom {
|
||||
use std::convert::TryInto;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn events_to_items<I: Iterator<Item = Event>>(events: I) -> Vec<Item<'static>> {
|
||||
|
@ -423,8 +421,6 @@ mod tests_minidom {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::convert::TryInto;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn items_to_events<'x, I: IntoIterator<Item = Item<'x>>>(
|
||||
|
|
|
@ -91,24 +91,24 @@ convert_via_fromstr_and_display! {
|
|||
f32,
|
||||
f64,
|
||||
char,
|
||||
std::net::IpAddr,
|
||||
std::net::Ipv4Addr,
|
||||
std::net::Ipv6Addr,
|
||||
std::net::SocketAddr,
|
||||
std::net::SocketAddrV4,
|
||||
std::net::SocketAddrV6,
|
||||
std::num::NonZeroU8,
|
||||
std::num::NonZeroU16,
|
||||
std::num::NonZeroU32,
|
||||
std::num::NonZeroU64,
|
||||
std::num::NonZeroU128,
|
||||
std::num::NonZeroUsize,
|
||||
std::num::NonZeroI8,
|
||||
std::num::NonZeroI16,
|
||||
std::num::NonZeroI32,
|
||||
std::num::NonZeroI64,
|
||||
std::num::NonZeroI128,
|
||||
std::num::NonZeroIsize,
|
||||
core::net::IpAddr,
|
||||
core::net::Ipv4Addr,
|
||||
core::net::Ipv6Addr,
|
||||
core::net::SocketAddr,
|
||||
core::net::SocketAddrV4,
|
||||
core::net::SocketAddrV6,
|
||||
core::num::NonZeroU8,
|
||||
core::num::NonZeroU16,
|
||||
core::num::NonZeroU32,
|
||||
core::num::NonZeroU64,
|
||||
core::num::NonZeroU128,
|
||||
core::num::NonZeroUsize,
|
||||
core::num::NonZeroI8,
|
||||
core::num::NonZeroI16,
|
||||
core::num::NonZeroI32,
|
||||
core::num::NonZeroI64,
|
||||
core::num::NonZeroI128,
|
||||
core::num::NonZeroIsize,
|
||||
|
||||
#[cfg(feature = "uuid")]
|
||||
uuid::Uuid,
|
||||
|
|
Loading…
Reference in a new issue