parsers: Replace std stuff with alloc/core stuff
This commit is contained in:
parent
1ce2f894aa
commit
087534be1e
23 changed files with 201 additions and 200 deletions
|
|
@ -33,7 +33,7 @@ fn get_ecaps2(disco: &DiscoInfoResult) -> Result<ECaps2, Error> {
|
|||
]))
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn main() -> Result<(), Box<dyn core::error::Error>> {
|
||||
let args: Vec<_> = env::args().collect();
|
||||
if args.len() != 2 {
|
||||
println!("Usage: {} <node>", args[0]);
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
// 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 std::borrow::Cow;
|
||||
use std::str::FromStr;
|
||||
use alloc::borrow::Cow;
|
||||
use core::str::FromStr;
|
||||
|
||||
use xso::{error::Error, text::Base64, AsXml, AsXmlText, FromXml, FromXmlText};
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ mod tests {
|
|||
.parse::<ContentId>()
|
||||
.unwrap_err();
|
||||
let message = match error {
|
||||
Error::TextParseError(error) if error.is::<std::num::ParseIntError>() => error,
|
||||
Error::TextParseError(error) if error.is::<core::num::ParseIntError>() => error,
|
||||
_ => panic!(),
|
||||
};
|
||||
assert_eq!(message.to_string(), "invalid digit found in string");
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
// 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 std::borrow::Cow;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::str::FromStr;
|
||||
use alloc::borrow::Cow;
|
||||
use core::fmt;
|
||||
use core::str::FromStr;
|
||||
|
||||
use minidom::IntoAttributeValue;
|
||||
use xso::{error::Error, AsXml, AsXmlText, FromXml, FromXmlText};
|
||||
|
|
@ -109,10 +109,10 @@ pub enum DatatypeError {
|
|||
},
|
||||
}
|
||||
|
||||
impl std::error::Error for DatatypeError {}
|
||||
impl core::error::Error for DatatypeError {}
|
||||
|
||||
impl Display for DatatypeError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
impl fmt::Display for DatatypeError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
DatatypeError::MissingPrefix { input } => {
|
||||
write!(f, "Missing prefix in validation datatype {input:?}.")
|
||||
|
|
@ -287,8 +287,8 @@ impl FromStr for Datatype {
|
|||
}
|
||||
}
|
||||
|
||||
impl Display for Datatype {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
impl fmt::Display for Datatype {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let value = match self {
|
||||
Datatype::AnyUri => "xs:anyURI",
|
||||
Datatype::Byte => "xs:byte",
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
// 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 std::borrow::Cow;
|
||||
use std::str::FromStr;
|
||||
use alloc::borrow::Cow;
|
||||
use core::str::FromStr;
|
||||
|
||||
use xso::{error::Error, AsXmlText, FromXmlText};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@
|
|||
// 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 std::borrow::Cow;
|
||||
use std::num::ParseIntError;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::str::FromStr;
|
||||
use alloc::borrow::Cow;
|
||||
use core::{
|
||||
num::ParseIntError,
|
||||
ops::{Deref, DerefMut},
|
||||
str::FromStr,
|
||||
};
|
||||
|
||||
use xso::{error::Error, text::Base64, AsXml, AsXmlText, FromXml, FromXmlText};
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ mod tests {
|
|||
let error = Open::try_from(elem).unwrap_err();
|
||||
let message = match error {
|
||||
FromElementError::Invalid(Error::TextParseError(error))
|
||||
if error.is::<std::num::ParseIntError>() =>
|
||||
if error.is::<core::num::ParseIntError>() =>
|
||||
{
|
||||
error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,9 @@ use crate::jingle_ice_udp::Transport as IceUdpTransport;
|
|||
use crate::jingle_rtp::Description as RtpDescription;
|
||||
use crate::jingle_s5b::Transport as Socks5Transport;
|
||||
use crate::ns;
|
||||
use alloc::{collections::BTreeMap, fmt};
|
||||
use jid::Jid;
|
||||
use minidom::Element;
|
||||
use std::collections::BTreeMap;
|
||||
use std::fmt;
|
||||
use xso::error::Error;
|
||||
|
||||
generate_attribute!(
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ use crate::date::DateTime;
|
|||
use crate::hashes::Hash;
|
||||
use crate::jingle::{ContentId, Creator};
|
||||
use crate::ns;
|
||||
use std::collections::BTreeMap;
|
||||
use std::str::FromStr;
|
||||
use alloc::collections::btree_map::BTreeMap;
|
||||
use core::str::FromStr;
|
||||
|
||||
/// Represents a range in a file.
|
||||
#[derive(FromXml, AsXml, PartialEq, Debug, Clone, Default)]
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ mod tests {
|
|||
let error = Transport::try_from(elem).unwrap_err();
|
||||
let message = match error {
|
||||
FromElementError::Invalid(Error::TextParseError(error))
|
||||
if error.is::<std::num::ParseIntError>() =>
|
||||
if error.is::<core::num::ParseIntError>() =>
|
||||
{
|
||||
error
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ mod tests {
|
|||
let error = Transport::try_from(elem).unwrap_err();
|
||||
let message = match error {
|
||||
FromElementError::Invalid(Error::TextParseError(error))
|
||||
if error.is::<std::num::ParseIntError>() =>
|
||||
if error.is::<core::num::ParseIntError>() =>
|
||||
{
|
||||
error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
// 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 std::net::IpAddr;
|
||||
use core::net::IpAddr;
|
||||
|
||||
use xso::{AsXml, FromXml};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
// 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 std::net::IpAddr;
|
||||
use core::net::IpAddr;
|
||||
|
||||
use xso::{AsXml, FromXml};
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ use xso::{
|
|||
};
|
||||
|
||||
use crate::ns;
|
||||
use core::net::IpAddr;
|
||||
use jid::Jid;
|
||||
use minidom::Element;
|
||||
use std::net::IpAddr;
|
||||
|
||||
generate_attribute!(
|
||||
/// The type of the connection being proposed by this candidate.
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#![warn(missing_docs)]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
pub use blake2;
|
||||
pub use jid;
|
||||
pub use minidom;
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ mod tests {
|
|||
let error = MediaElement::try_from(elem).unwrap_err();
|
||||
let error = match error {
|
||||
FromElementError::Invalid(Error::TextParseError(error))
|
||||
if error.is::<std::num::ParseIntError>() =>
|
||||
if error.is::<core::num::ParseIntError>() =>
|
||||
{
|
||||
error
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ mod tests {
|
|||
let error = MediaElement::try_from(elem).unwrap_err();
|
||||
let error = match error {
|
||||
FromElementError::Invalid(Error::TextParseError(error))
|
||||
if error.is::<std::num::ParseIntError>() =>
|
||||
if error.is::<core::num::ParseIntError>() =>
|
||||
{
|
||||
error
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ mod tests {
|
|||
let error = MediaElement::try_from(elem).unwrap_err();
|
||||
let error = match error {
|
||||
FromElementError::Invalid(Error::TextParseError(error))
|
||||
if error.is::<std::num::ParseIntError>() =>
|
||||
if error.is::<core::num::ParseIntError>() =>
|
||||
{
|
||||
error
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ mod tests {
|
|||
let error = MediaElement::try_from(elem).unwrap_err();
|
||||
let error = match error {
|
||||
FromElementError::Invalid(Error::TextParseError(error))
|
||||
if error.is::<std::num::ParseIntError>() =>
|
||||
if error.is::<core::num::ParseIntError>() =>
|
||||
{
|
||||
error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use crate::ns;
|
||||
use alloc::collections::BTreeMap;
|
||||
use jid::Jid;
|
||||
use minidom::Element;
|
||||
use std::collections::BTreeMap;
|
||||
use xso::error::{Error, FromElementError};
|
||||
|
||||
/// Should be implemented on every known payload of a `<message/>`.
|
||||
|
|
@ -256,7 +256,7 @@ impl Message {
|
|||
}
|
||||
}
|
||||
buf.extend(iter);
|
||||
std::mem::swap(&mut buf, &mut self.payloads);
|
||||
core::mem::swap(&mut buf, &mut self.payloads);
|
||||
result
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ mod tests {
|
|||
let error = Status::try_from(elem).unwrap_err();
|
||||
let error = match error {
|
||||
FromElementError::Invalid(Error::TextParseError(error))
|
||||
if error.is::<std::num::ParseIntError>() =>
|
||||
if error.is::<core::num::ParseIntError>() =>
|
||||
{
|
||||
error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,9 @@
|
|||
use xso::{error::Error, AsOptionalXmlText, AsXml, AsXmlText, FromXml, FromXmlText};
|
||||
|
||||
use crate::ns;
|
||||
use alloc::{borrow::Cow, collections::BTreeMap};
|
||||
use jid::Jid;
|
||||
use minidom::Element;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
/// Should be implemented on every known payload of a `<presence/>`.
|
||||
pub trait PresencePayload: TryFrom<Element> + Into<Element> {}
|
||||
|
|
@ -509,7 +508,7 @@ mod tests {
|
|||
let error = Presence::try_from(elem).unwrap_err();
|
||||
match error {
|
||||
FromElementError::Invalid(Error::TextParseError(e))
|
||||
if e.is::<std::num::ParseIntError>() =>
|
||||
if e.is::<core::num::ParseIntError>() =>
|
||||
{
|
||||
()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
use xso::{error::Error, AsXml, AsXmlText, FromXml, FromXmlText};
|
||||
|
||||
use crate::ns;
|
||||
use std::borrow::Cow;
|
||||
use alloc::borrow::Cow;
|
||||
|
||||
/// One type of channel-binding, as [defined by the IANA](https://www.iana.org/assignments/channel-binding-types/channel-binding-types.xhtml)
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ use xso::{text::EmptyAsNone, AsXml, FromXml};
|
|||
use crate::message::MessagePayload;
|
||||
use crate::ns;
|
||||
use crate::presence::PresencePayload;
|
||||
use alloc::collections::BTreeMap;
|
||||
use core::convert::TryFrom;
|
||||
use jid::Jid;
|
||||
use minidom::Element;
|
||||
use std::collections::BTreeMap;
|
||||
use std::convert::TryFrom;
|
||||
use xso::error::{Error, FromElementError};
|
||||
|
||||
generate_attribute!(
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
// 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::fmt;
|
||||
use std::error::Error;
|
||||
use core::{error::Error, fmt};
|
||||
|
||||
use minidom::Element;
|
||||
use xso::{AsXml, FromXml};
|
||||
|
|
@ -335,7 +334,7 @@ impl fmt::Display for StreamError {
|
|||
}
|
||||
}
|
||||
|
||||
/// Wrapper around [`StreamError`] which implements [`std::error::Error`]
|
||||
/// Wrapper around [`StreamError`] which implements [`core::error::Error`]
|
||||
/// with an appropriate error message.
|
||||
#[derive(FromXml, AsXml, Debug)]
|
||||
#[xml(transparent)]
|
||||
|
|
@ -349,7 +348,7 @@ impl fmt::Display for ReceivedStreamError {
|
|||
|
||||
impl Error for ReceivedStreamError {}
|
||||
|
||||
/// Wrapper around [`StreamError`] which implements [`std::error::Error`]
|
||||
/// Wrapper around [`StreamError`] which implements [`core::error::Error`]
|
||||
/// with an appropriate error message.
|
||||
#[derive(FromXml, AsXml, Debug)]
|
||||
#[xml(transparent)]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
use xso::{AsXml, FromXml};
|
||||
|
||||
use crate::ns;
|
||||
use std::num::NonZeroU32;
|
||||
use core::num::NonZeroU32;
|
||||
|
||||
/// Advertises limits on this stream.
|
||||
#[derive(FromXml, AsXml, Debug, Clone, PartialEq)]
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ mod helpers {
|
|||
use minidom::Element;
|
||||
use xso::{error::FromElementError, transform, try_from_element, AsXml, FromXml};
|
||||
|
||||
pub(super) fn roundtrip_full<T: AsXml + FromXml + PartialEq + std::fmt::Debug + Clone>(
|
||||
pub(super) fn roundtrip_full<T: AsXml + FromXml + PartialEq + core::fmt::Debug + Clone>(
|
||||
s: &str,
|
||||
) {
|
||||
let initial: Element = s.parse().unwrap();
|
||||
|
|
@ -88,7 +88,7 @@ struct Empty;
|
|||
#[test]
|
||||
fn empty_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -98,7 +98,7 @@ fn empty_roundtrip() {
|
|||
#[test]
|
||||
fn empty_name_mismatch() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -111,7 +111,7 @@ fn empty_name_mismatch() {
|
|||
#[test]
|
||||
fn empty_namespace_mismatch() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -124,7 +124,7 @@ fn empty_namespace_mismatch() {
|
|||
#[test]
|
||||
fn empty_unexpected_attribute() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -139,7 +139,7 @@ fn empty_unexpected_attribute() {
|
|||
#[test]
|
||||
fn empty_unexpected_child() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -154,7 +154,7 @@ fn empty_unexpected_child() {
|
|||
#[test]
|
||||
fn empty_qname_check_has_precedence_over_attr_check() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -171,7 +171,7 @@ struct NamePath;
|
|||
#[test]
|
||||
fn name_path_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -185,7 +185,7 @@ struct NamespaceLit;
|
|||
#[test]
|
||||
fn namespace_lit_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -202,7 +202,7 @@ struct RequiredAttribute {
|
|||
#[test]
|
||||
fn required_attribute_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -212,7 +212,7 @@ fn required_attribute_roundtrip() {
|
|||
#[test]
|
||||
fn required_attribute_positive() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -223,7 +223,7 @@ fn required_attribute_positive() {
|
|||
#[test]
|
||||
fn required_attribute_missing() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -249,7 +249,7 @@ struct RenamedAttribute {
|
|||
#[test]
|
||||
fn renamed_attribute_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -272,7 +272,7 @@ struct NamespacedAttribute {
|
|||
#[test]
|
||||
fn namespaced_attribute_roundtrip_a() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -286,7 +286,7 @@ fn namespaced_attribute_roundtrip_a() {
|
|||
#[test]
|
||||
fn namespaced_attribute_roundtrip_b() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -307,7 +307,7 @@ struct PrefixedAttribute {
|
|||
#[test]
|
||||
fn prefixed_attribute_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -324,7 +324,7 @@ struct RequiredNonStringAttribute {
|
|||
#[test]
|
||||
fn required_non_string_attribute_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -335,16 +335,16 @@ fn required_non_string_attribute_roundtrip() {
|
|||
#[xml(namespace = NS1, name = "attr")]
|
||||
struct DefaultAttribute {
|
||||
#[xml(attribute(default))]
|
||||
foo: std::option::Option<String>,
|
||||
foo: core::option::Option<String>,
|
||||
|
||||
#[xml(attribute(default))]
|
||||
bar: std::option::Option<u16>,
|
||||
bar: core::option::Option<u16>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_attribute_roundtrip_aa() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -354,7 +354,7 @@ fn default_attribute_roundtrip_aa() {
|
|||
#[test]
|
||||
fn default_attribute_roundtrip_pa() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -364,7 +364,7 @@ fn default_attribute_roundtrip_pa() {
|
|||
#[test]
|
||||
fn default_attribute_roundtrip_ap() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -374,7 +374,7 @@ fn default_attribute_roundtrip_ap() {
|
|||
#[test]
|
||||
fn default_attribute_roundtrip_pp() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -391,7 +391,7 @@ struct TextString {
|
|||
#[test]
|
||||
fn text_string_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -401,7 +401,7 @@ fn text_string_roundtrip() {
|
|||
#[test]
|
||||
fn text_string_positive_preserves_whitespace() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -419,7 +419,7 @@ struct TextNonString {
|
|||
#[test]
|
||||
fn text_non_string_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -433,7 +433,7 @@ struct IgnoresWhitespaceWithoutTextConsumer;
|
|||
#[test]
|
||||
fn ignores_whitespace_without_text_consumer_positive() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -450,7 +450,7 @@ struct FailsTextWithoutTextConsumer;
|
|||
#[test]
|
||||
fn fails_text_without_text_consumer_positive() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -469,13 +469,13 @@ fn fails_text_without_text_consumer_positive() {
|
|||
#[xml(namespace = NS1, name = "text")]
|
||||
struct TextWithCodec {
|
||||
#[xml(text(codec = xso::text::EmptyAsNone))]
|
||||
text: std::option::Option<String>,
|
||||
text: core::option::Option<String>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_with_codec_roundtrip_empty() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -485,7 +485,7 @@ fn text_with_codec_roundtrip_empty() {
|
|||
#[test]
|
||||
fn text_with_codec_roundtrip_non_empty() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -502,7 +502,7 @@ struct Parent {
|
|||
#[test]
|
||||
fn parent_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -512,7 +512,7 @@ fn parent_roundtrip() {
|
|||
#[test]
|
||||
fn parent_positive() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -525,7 +525,7 @@ fn parent_positive() {
|
|||
#[test]
|
||||
fn parent_negative_duplicate_child() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -539,13 +539,13 @@ fn parent_negative_duplicate_child() {
|
|||
#[xml(namespace = NS1, name = "parent")]
|
||||
struct OptionalChild {
|
||||
#[xml(child(default))]
|
||||
child: std::option::Option<RequiredAttribute>,
|
||||
child: core::option::Option<RequiredAttribute>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optional_child_roundtrip_present() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -557,7 +557,7 @@ fn optional_child_roundtrip_present() {
|
|||
#[test]
|
||||
fn optional_child_roundtrip_absent() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -568,13 +568,13 @@ fn optional_child_roundtrip_absent() {
|
|||
#[xml(namespace = NS1, name = "elem")]
|
||||
struct BoxedChild {
|
||||
#[xml(child(default))]
|
||||
child: std::option::Option<Box<BoxedChild>>,
|
||||
child: core::option::Option<Box<BoxedChild>>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn boxed_child_roundtrip_absent() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -584,7 +584,7 @@ fn boxed_child_roundtrip_absent() {
|
|||
#[test]
|
||||
fn boxed_child_roundtrip_nested_1() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -594,7 +594,7 @@ fn boxed_child_roundtrip_nested_1() {
|
|||
#[test]
|
||||
fn boxed_child_roundtrip_nested_2() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -608,7 +608,7 @@ struct RenamedTypes;
|
|||
#[test]
|
||||
fn renamed_types_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -620,8 +620,8 @@ fn renamed_types_roundtrip() {
|
|||
fn renamed_types_get_renamed() {
|
||||
// these merely serve as a test that the types are declared with the names
|
||||
// given in the attributes.
|
||||
assert!(std::mem::size_of::<RenamedBuilder>() >= 0);
|
||||
assert!(std::mem::size_of::<RenamedIter>() >= 0);
|
||||
assert!(core::mem::size_of::<RenamedBuilder>() >= 0);
|
||||
assert!(core::mem::size_of::<RenamedIter>() >= 0);
|
||||
}
|
||||
|
||||
// What is this, you may wonder?
|
||||
|
|
@ -649,7 +649,7 @@ enum NameSwitchedEnum {
|
|||
#[test]
|
||||
fn name_switched_enum_positive_variant_1() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -664,7 +664,7 @@ fn name_switched_enum_positive_variant_1() {
|
|||
#[test]
|
||||
fn name_switched_enum_positive_variant_2() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -679,7 +679,7 @@ fn name_switched_enum_positive_variant_2() {
|
|||
#[test]
|
||||
fn name_switched_enum_negative_name_mismatch() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -692,7 +692,7 @@ fn name_switched_enum_negative_name_mismatch() {
|
|||
#[test]
|
||||
fn name_switched_enum_negative_namespace_mismatch() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -705,7 +705,7 @@ fn name_switched_enum_negative_namespace_mismatch() {
|
|||
#[test]
|
||||
fn name_switched_enum_roundtrip_variant_1() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -715,7 +715,7 @@ fn name_switched_enum_roundtrip_variant_1() {
|
|||
#[test]
|
||||
fn name_switched_enum_roundtrip_variant_2() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -732,7 +732,7 @@ enum RenamedEnumTypes {
|
|||
#[test]
|
||||
fn renamed_enum_types_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -744,8 +744,8 @@ fn renamed_enum_types_roundtrip() {
|
|||
fn renamed_enum_types_get_renamed() {
|
||||
// these merely serve as a test that the types are declared with the names
|
||||
// given in the attributes.
|
||||
assert!(std::mem::size_of::<RenamedEnumBuilder>() >= 0);
|
||||
assert!(std::mem::size_of::<RenamedEnumIter>() >= 0);
|
||||
assert!(core::mem::size_of::<RenamedEnumBuilder>() >= 0);
|
||||
assert!(core::mem::size_of::<RenamedEnumIter>() >= 0);
|
||||
}
|
||||
|
||||
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
|
||||
|
|
@ -766,7 +766,7 @@ enum ExhaustiveNameSwitchedEnum {
|
|||
#[test]
|
||||
fn exhaustive_name_switched_enum_negative_name_mismatch() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -779,7 +779,7 @@ fn exhaustive_name_switched_enum_negative_name_mismatch() {
|
|||
#[test]
|
||||
fn exhaustive_name_switched_enum_negative_namespace_mismatch() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -792,7 +792,7 @@ fn exhaustive_name_switched_enum_negative_namespace_mismatch() {
|
|||
#[test]
|
||||
fn exhaustive_name_switched_enum_roundtrip_variant_1() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -802,7 +802,7 @@ fn exhaustive_name_switched_enum_roundtrip_variant_1() {
|
|||
#[test]
|
||||
fn exhaustive_name_switched_enum_roundtrip_variant_2() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -819,7 +819,7 @@ struct Children {
|
|||
#[test]
|
||||
fn children_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -838,7 +838,7 @@ struct TextExtract {
|
|||
#[test]
|
||||
fn text_extract_positive() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -855,7 +855,7 @@ fn text_extract_positive() {
|
|||
#[test]
|
||||
fn text_extract_negative_absent_child() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -872,7 +872,7 @@ fn text_extract_negative_absent_child() {
|
|||
#[test]
|
||||
fn text_extract_negative_unexpected_attribute_in_child() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -889,7 +889,7 @@ fn text_extract_negative_unexpected_attribute_in_child() {
|
|||
#[test]
|
||||
fn text_extract_negative_unexpected_child_in_child() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -908,7 +908,7 @@ fn text_extract_negative_unexpected_child_in_child() {
|
|||
#[test]
|
||||
fn text_extract_negative_duplicate_child() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -927,7 +927,7 @@ fn text_extract_negative_duplicate_child() {
|
|||
#[test]
|
||||
fn text_extract_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -946,7 +946,7 @@ struct AttributeExtract {
|
|||
#[test]
|
||||
fn attribute_extract_positive() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -963,7 +963,7 @@ fn attribute_extract_positive() {
|
|||
#[test]
|
||||
fn attribute_extract_negative_absent_attribute() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -980,7 +980,7 @@ fn attribute_extract_negative_absent_attribute() {
|
|||
#[test]
|
||||
fn attribute_extract_negative_unexpected_text_in_child() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -999,7 +999,7 @@ fn attribute_extract_negative_unexpected_text_in_child() {
|
|||
#[test]
|
||||
fn attribute_extract_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1012,13 +1012,13 @@ fn attribute_extract_roundtrip() {
|
|||
#[xml(namespace = NS1, name = "parent")]
|
||||
struct OptionalAttributeExtract {
|
||||
#[xml(extract(namespace = NS1, name = "child", fields(attribute(name = "foo", default))))]
|
||||
contents: ::std::option::Option<String>,
|
||||
contents: ::core::option::Option<String>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optional_attribute_extract_positive_present() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1037,7 +1037,7 @@ fn optional_attribute_extract_positive_present() {
|
|||
#[test]
|
||||
fn optional_attribute_extract_positive_present_empty() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1056,7 +1056,7 @@ fn optional_attribute_extract_positive_present_empty() {
|
|||
#[test]
|
||||
fn optional_attribute_extract_positive_absent() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1070,7 +1070,7 @@ fn optional_attribute_extract_positive_absent() {
|
|||
#[test]
|
||||
fn optional_attribute_extract_roundtrip_present() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1082,7 +1082,7 @@ fn optional_attribute_extract_roundtrip_present() {
|
|||
#[test]
|
||||
fn optional_attribute_extract_roundtrip_present_empty() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1094,7 +1094,7 @@ fn optional_attribute_extract_roundtrip_present_empty() {
|
|||
#[test]
|
||||
fn optional_attribute_extract_roundtrip_absent() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1111,7 +1111,7 @@ struct ChildExtract {
|
|||
#[test]
|
||||
fn child_extract_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1132,7 +1132,7 @@ struct NestedExtract {
|
|||
#[test]
|
||||
fn nested_extract_positive() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1149,7 +1149,7 @@ fn nested_extract_positive() {
|
|||
#[test]
|
||||
fn nested_extract_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1166,7 +1166,7 @@ struct ExtractOmitNamespace {
|
|||
#[test]
|
||||
fn extract_omit_namespace_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1185,7 +1185,7 @@ struct ExtractOmitName {
|
|||
#[test]
|
||||
fn extract_omit_name_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1204,7 +1204,7 @@ struct ExtractOmitNameAndNamespace {
|
|||
#[test]
|
||||
fn extract_omit_name_and_namespace_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1223,7 +1223,7 @@ struct TextExtractVec {
|
|||
#[test]
|
||||
fn text_extract_vec_positive_nonempty() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1242,7 +1242,7 @@ fn text_extract_vec_positive_nonempty() {
|
|||
#[test]
|
||||
fn text_extract_vec_positive_empty() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1257,7 +1257,7 @@ fn text_extract_vec_positive_empty() {
|
|||
#[test]
|
||||
fn text_extract_vec_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1276,7 +1276,7 @@ struct AttributeExtractVec {
|
|||
#[test]
|
||||
fn text_extract_attribute_vec_positive_nonempty() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1295,7 +1295,7 @@ fn text_extract_attribute_vec_positive_nonempty() {
|
|||
#[test]
|
||||
fn text_extract_attribute_vec_positive_empty() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1310,7 +1310,7 @@ fn text_extract_attribute_vec_positive_empty() {
|
|||
#[test]
|
||||
fn text_extract_attribute_vec_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1323,13 +1323,13 @@ fn text_extract_attribute_vec_roundtrip() {
|
|||
#[xml(namespace = NS1, name = "parent")]
|
||||
struct TextOptionalExtract {
|
||||
#[xml(extract(namespace = NS1, name = "child", default, fields(text(type_ = String))))]
|
||||
contents: ::std::option::Option<String>,
|
||||
contents: ::core::option::Option<String>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_optional_extract_positive_present() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1348,7 +1348,7 @@ fn text_optional_extract_positive_present() {
|
|||
#[test]
|
||||
fn text_optional_extract_positive_absent_child() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1361,7 +1361,7 @@ fn text_optional_extract_positive_absent_child() {
|
|||
#[test]
|
||||
fn text_optional_extract_roundtrip_present() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1373,7 +1373,7 @@ fn text_optional_extract_roundtrip_present() {
|
|||
#[test]
|
||||
fn text_optional_extract_roundtrip_absent() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1384,13 +1384,13 @@ fn text_optional_extract_roundtrip_absent() {
|
|||
#[xml(namespace = NS1, name = "parent")]
|
||||
struct OptionalAttributeOptionalExtract {
|
||||
#[xml(extract(namespace = NS1, name = "child", default, fields(attribute(name = "foo", default))))]
|
||||
contents: ::std::option::Option<String>,
|
||||
contents: ::core::option::Option<String>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optional_attribute_optional_extract_positive_present() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1409,7 +1409,7 @@ fn optional_attribute_optional_extract_positive_present() {
|
|||
#[test]
|
||||
fn optional_attribute_optional_extract_positive_absent_attribute() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1424,7 +1424,7 @@ fn optional_attribute_optional_extract_positive_absent_attribute() {
|
|||
#[test]
|
||||
fn optional_attribute_optional_extract_positive_absent_element() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1437,7 +1437,7 @@ fn optional_attribute_optional_extract_positive_absent_element() {
|
|||
#[test]
|
||||
fn optional_attribute_optional_extract_roundtrip_present() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1449,7 +1449,7 @@ fn optional_attribute_optional_extract_roundtrip_present() {
|
|||
#[test]
|
||||
fn optional_attribute_optional_extract_roundtrip_absent_attribute() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1461,14 +1461,14 @@ fn optional_attribute_optional_extract_roundtrip_absent_attribute() {
|
|||
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
|
||||
#[xml(namespace = NS1, name = "parent")]
|
||||
struct OptionalAttributeOptionalExtractDoubleOption {
|
||||
#[xml(extract(namespace = NS1, name = "child", default, fields(attribute(name = "foo", type_ = ::std::option::Option<String>, default))))]
|
||||
contents: ::std::option::Option<::std::option::Option<String>>,
|
||||
#[xml(extract(namespace = NS1, name = "child", default, fields(attribute(name = "foo", type_ = ::core::option::Option<String>, default))))]
|
||||
contents: ::core::option::Option<::core::option::Option<String>>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optional_attribute_optional_extract_double_option_positive_present() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1487,7 +1487,7 @@ fn optional_attribute_optional_extract_double_option_positive_present() {
|
|||
#[test]
|
||||
fn optional_attribute_optional_extract_double_option_positive_absent_attribute() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1504,7 +1504,7 @@ fn optional_attribute_optional_extract_double_option_positive_absent_attribute()
|
|||
#[test]
|
||||
fn optional_attribute_optional_extract_double_option_positive_absent_element() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1519,7 +1519,7 @@ fn optional_attribute_optional_extract_double_option_positive_absent_element() {
|
|||
#[test]
|
||||
fn optional_attribute_optional_extract_double_option_roundtrip_present() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1531,7 +1531,7 @@ fn optional_attribute_optional_extract_double_option_roundtrip_present() {
|
|||
#[test]
|
||||
fn optional_attribute_optional_extract_double_option_roundtrip_absent_attribute() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1543,7 +1543,7 @@ fn optional_attribute_optional_extract_double_option_roundtrip_absent_attribute(
|
|||
#[test]
|
||||
fn optional_attribute_optional_extract_double_option_roundtrip_absent_child() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1562,7 +1562,7 @@ struct ElementCatchall {
|
|||
#[test]
|
||||
fn element_catchall_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1578,7 +1578,7 @@ struct TransparentStruct(RequiredAttribute);
|
|||
#[test]
|
||||
fn transparent_struct_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1594,7 +1594,7 @@ struct TransparentStructNamed {
|
|||
#[test]
|
||||
fn transparent_struct_named_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1617,7 +1617,7 @@ enum DynamicEnum {
|
|||
#[test]
|
||||
fn dynamic_enum_roundtrip_a() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1627,7 +1627,7 @@ fn dynamic_enum_roundtrip_a() {
|
|||
#[test]
|
||||
fn dynamic_enum_roundtrip_b() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1644,7 +1644,7 @@ struct FallibleParse {
|
|||
#[test]
|
||||
fn fallible_parse_positive_ok() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1661,7 +1661,7 @@ fn fallible_parse_positive_ok() {
|
|||
#[test]
|
||||
fn fallible_parse_positive_err() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1686,7 +1686,7 @@ struct ExtractTupleToCollection {
|
|||
#[test]
|
||||
fn extract_tuple_to_collection_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1708,7 +1708,7 @@ struct ExtractTuple {
|
|||
#[test]
|
||||
fn extract_tuple_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1730,7 +1730,7 @@ struct ExtractOptionalTuple {
|
|||
#[test]
|
||||
fn extract_optional_tuple_roundtrip_present() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1751,7 +1751,7 @@ fn extract_optional_tuple_roundtrip_present() {
|
|||
#[test]
|
||||
fn extract_optional_tuple_roundtrip_absent() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1765,13 +1765,13 @@ struct ExtractTupleToMap {
|
|||
attribute(name = "xml:lang", type_ = ::core::option::Option<String>, default),
|
||||
text(type_ = String),
|
||||
)))]
|
||||
contents: std::collections::BTreeMap<::core::option::Option<String>, String>,
|
||||
contents: alloc::collections::BTreeMap<::core::option::Option<String>, String>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extract_tuple_to_map_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1787,7 +1787,7 @@ struct IgnoreUnknownAttributes;
|
|||
#[test]
|
||||
fn ignore_unknown_attributes_empty_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1797,7 +1797,7 @@ fn ignore_unknown_attributes_empty_roundtrip() {
|
|||
#[test]
|
||||
fn ignore_unknown_attributes_positive() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1810,7 +1810,7 @@ fn ignore_unknown_attributes_positive() {
|
|||
#[test]
|
||||
fn ignore_unknown_attributes_negative_unexpected_child() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1829,7 +1829,7 @@ struct IgnoreUnknownChildren;
|
|||
#[test]
|
||||
fn ignore_unknown_children_empty_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1839,7 +1839,7 @@ fn ignore_unknown_children_empty_roundtrip() {
|
|||
#[test]
|
||||
fn ignore_unknown_children_positive() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1852,7 +1852,7 @@ fn ignore_unknown_children_positive() {
|
|||
#[test]
|
||||
fn ignore_unknown_children_negative_unexpected_attribute() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1876,7 +1876,7 @@ struct ExtractIgnoreUnknownStuff {
|
|||
#[test]
|
||||
fn extract_ignore_unknown_stuff_positive() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
@ -1893,7 +1893,7 @@ fn extract_ignore_unknown_stuff_positive() {
|
|||
#[test]
|
||||
fn extract_ignore_unknown_stuff_roundtrip() {
|
||||
#[allow(unused_imports)]
|
||||
use std::{
|
||||
use core::{
|
||||
option::Option::{None, Some},
|
||||
result::Result::{Err, Ok},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ macro_rules! get_attr {
|
|||
($elem:ident, $attr:tt, Default, $value:ident, $func:expr) => {
|
||||
match $elem.attr($attr) {
|
||||
Some($value) => $func,
|
||||
None => ::std::default::Default::default(),
|
||||
None => ::core::default::Default::default(),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -87,18 +87,18 @@ macro_rules! generate_attribute {
|
|||
s.parse().map_err(xso::error::Error::text_parse_error)
|
||||
}
|
||||
}
|
||||
impl std::fmt::Display for $elem {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
||||
impl core::fmt::Display for $elem {
|
||||
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
|
||||
write!(fmt, "{}", match self {
|
||||
$($elem::$a => $b),+
|
||||
})
|
||||
}
|
||||
}
|
||||
impl ::xso::AsXmlText for $elem {
|
||||
fn as_xml_text(&self) -> Result<::std::borrow::Cow<'_, str>, xso::error::Error> {
|
||||
fn as_xml_text(&self) -> Result<::alloc::borrow::Cow<'_, str>, xso::error::Error> {
|
||||
match self {
|
||||
$(
|
||||
$elem::$a => Ok(::std::borrow::Cow::Borrowed($b))
|
||||
$elem::$a => Ok(::alloc::borrow::Cow::Borrowed($b))
|
||||
),+
|
||||
}
|
||||
}
|
||||
|
|
@ -135,15 +135,15 @@ macro_rules! generate_attribute {
|
|||
}
|
||||
}
|
||||
impl ::xso::AsXmlText for $elem {
|
||||
fn as_xml_text(&self) -> Result<std::borrow::Cow<'_, str>, xso::error::Error> {
|
||||
Ok(std::borrow::Cow::Borrowed(match self {
|
||||
fn as_xml_text(&self) -> Result<alloc::borrow::Cow<'_, str>, xso::error::Error> {
|
||||
Ok(alloc::borrow::Cow::Borrowed(match self {
|
||||
$($elem::$a => $b),+
|
||||
}))
|
||||
}
|
||||
|
||||
#[allow(unreachable_patterns)]
|
||||
fn as_optional_xml_text(&self) -> Result<Option<std::borrow::Cow<'_, str>>, xso::error::Error> {
|
||||
Ok(Some(std::borrow::Cow::Borrowed(match self {
|
||||
fn as_optional_xml_text(&self) -> Result<Option<alloc::borrow::Cow<'_, str>>, xso::error::Error> {
|
||||
Ok(Some(alloc::borrow::Cow::Borrowed(match self {
|
||||
$elem::$default => return Ok(None),
|
||||
$($elem::$a => $b),+
|
||||
})))
|
||||
|
|
@ -158,7 +158,7 @@ macro_rules! generate_attribute {
|
|||
}))
|
||||
}
|
||||
}
|
||||
impl ::std::default::Default for $elem {
|
||||
impl ::core::default::Default for $elem {
|
||||
fn default() -> $elem {
|
||||
$elem::$default
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ macro_rules! generate_attribute {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl ::std::default::Default for $elem {
|
||||
impl ::core::default::Default for $elem {
|
||||
fn default() -> $elem {
|
||||
$elem::None
|
||||
}
|
||||
|
|
@ -201,13 +201,13 @@ macro_rules! generate_attribute {
|
|||
}
|
||||
}
|
||||
impl ::xso::AsXmlText for $elem {
|
||||
fn as_xml_text(&self) -> Result<::std::borrow::Cow<'_, str>, xso::error::Error> {
|
||||
Ok(::std::borrow::Cow::Borrowed($value))
|
||||
fn as_xml_text(&self) -> Result<::alloc::borrow::Cow<'_, str>, xso::error::Error> {
|
||||
Ok(::alloc::borrow::Cow::Borrowed($value))
|
||||
}
|
||||
|
||||
#[allow(unreachable_patterns)]
|
||||
fn as_optional_xml_text(&self) -> Result<Option<std::borrow::Cow<'_, str>>, xso::error::Error> {
|
||||
Ok(Some(std::borrow::Cow::Borrowed(match self {
|
||||
fn as_optional_xml_text(&self) -> Result<Option<alloc::borrow::Cow<'_, str>>, xso::error::Error> {
|
||||
Ok(Some(alloc::borrow::Cow::Borrowed(match self {
|
||||
$elem::$symbol => $value,
|
||||
$elem::None => return Ok(None),
|
||||
})))
|
||||
|
|
@ -232,7 +232,7 @@ macro_rules! generate_attribute {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl ::std::default::Default for $elem {
|
||||
impl ::core::default::Default for $elem {
|
||||
fn default() -> $elem {
|
||||
$elem($default)
|
||||
}
|
||||
|
|
@ -243,14 +243,14 @@ macro_rules! generate_attribute {
|
|||
}
|
||||
}
|
||||
impl ::xso::AsXmlText for $elem {
|
||||
fn as_xml_text(&self) -> Result<::std::borrow::Cow<'_, str>, xso::error::Error> {
|
||||
Ok(::std::borrow::Cow::Owned(format!("{}", self.0)))
|
||||
fn as_xml_text(&self) -> Result<::alloc::borrow::Cow<'_, str>, xso::error::Error> {
|
||||
Ok(::alloc::borrow::Cow::Owned(format!("{}", self.0)))
|
||||
}
|
||||
|
||||
fn as_optional_xml_text(&self) -> Result<Option<::std::borrow::Cow<'_, str>>, xso::error::Error> {
|
||||
fn as_optional_xml_text(&self) -> Result<Option<::alloc::borrow::Cow<'_, str>>, xso::error::Error> {
|
||||
match self.0 {
|
||||
$default => Ok(None),
|
||||
_ => Ok(Some(::std::borrow::Cow::Owned(format!("{}", self.0)))),
|
||||
_ => Ok(Some(::alloc::borrow::Cow::Owned(format!("{}", self.0)))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -267,7 +267,7 @@ macro_rules! generate_attribute_enum {
|
|||
$enum
|
||||
),+
|
||||
}
|
||||
impl ::std::convert::TryFrom<minidom::Element> for $elem {
|
||||
impl ::core::convert::TryFrom<minidom::Element> for $elem {
|
||||
type Error = xso::error::FromElementError;
|
||||
fn try_from(elem: minidom::Element) -> Result<$elem, xso::error::FromElementError> {
|
||||
check_ns_only!(elem, $name, $ns);
|
||||
|
|
@ -395,8 +395,8 @@ macro_rules! generate_id {
|
|||
}
|
||||
}
|
||||
impl ::xso::AsXmlText for $elem {
|
||||
fn as_xml_text(&self) ->Result<::std::borrow::Cow<'_, str>, xso::error::Error> {
|
||||
Ok(::std::borrow::Cow::Borrowed(self.0.as_str()))
|
||||
fn as_xml_text(&self) ->Result<::alloc::borrow::Cow<'_, str>, xso::error::Error> {
|
||||
Ok(::alloc::borrow::Cow::Borrowed(self.0.as_str()))
|
||||
}
|
||||
}
|
||||
impl ::minidom::IntoAttributeValue for $elem {
|
||||
|
|
@ -429,14 +429,14 @@ macro_rules! generate_elem_id {
|
|||
#[cfg(test)]
|
||||
macro_rules! assert_size (
|
||||
($t:ty, $sz:expr) => (
|
||||
assert_eq!(::std::mem::size_of::<$t>(), $sz);
|
||||
assert_eq!(::core::mem::size_of::<$t>(), $sz);
|
||||
);
|
||||
);
|
||||
|
||||
// TODO: move that to src/pubsub/mod.rs, once we figure out how to use macros from there.
|
||||
macro_rules! impl_pubsub_item {
|
||||
($item:ident, $ns:ident) => {
|
||||
impl ::std::convert::TryFrom<minidom::Element> for $item {
|
||||
impl ::core::convert::TryFrom<minidom::Element> for $item {
|
||||
type Error = FromElementError;
|
||||
|
||||
fn try_from(mut elem: minidom::Element) -> Result<$item, FromElementError> {
|
||||
|
|
@ -487,7 +487,7 @@ macro_rules! impl_pubsub_item {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::std::ops::Deref for $item {
|
||||
impl ::core::ops::Deref for $item {
|
||||
type Target = crate::pubsub::Item;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
|
@ -495,7 +495,7 @@ macro_rules! impl_pubsub_item {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::std::ops::DerefMut for $item {
|
||||
impl ::core::ops::DerefMut for $item {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.0
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue