minidom: Replace std stuff with alloc/core stuff
This commit is contained in:
parent
087534be1e
commit
3ebc30c7ab
6 changed files with 23 additions and 16 deletions
|
|
@ -22,3 +22,7 @@ gitlab = { repository = "xmpp-rs/xmpp-rs" }
|
|||
|
||||
[dependencies]
|
||||
rxml = { version = "0.12.0", default-features = false, features = ["compact_str"] }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = []
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ impl_into_attribute_values!(
|
|||
i32,
|
||||
i16,
|
||||
i8,
|
||||
::std::net::IpAddr
|
||||
::core::net::IpAddr
|
||||
);
|
||||
|
||||
impl IntoAttributeValue for String {
|
||||
|
|
@ -70,8 +70,8 @@ impl<T: IntoAttributeValue> IntoAttributeValue for Option<T> {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::IntoAttributeValue;
|
||||
use std::net::IpAddr;
|
||||
use std::str::FromStr;
|
||||
use core::net::IpAddr;
|
||||
use core::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn test_into_attribute_value_on_ints() {
|
||||
|
|
|
|||
|
|
@ -19,18 +19,19 @@ use crate::node::Node;
|
|||
use crate::prefixes::{Namespace, Prefix, Prefixes};
|
||||
use crate::tree_builder::TreeBuilder;
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::collections::{btree_map, BTreeMap};
|
||||
use alloc::{
|
||||
borrow::Cow,
|
||||
collections::btree_map::{self, BTreeMap},
|
||||
};
|
||||
|
||||
use core::slice;
|
||||
use core::str::FromStr;
|
||||
|
||||
use std::io::{self, BufRead, Write};
|
||||
use std::str;
|
||||
|
||||
use rxml::writer::{Encoder, Item, TrackNamespace};
|
||||
use rxml::{Namespace as RxmlNamespace, RawReader, XmlVersion};
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use std::slice;
|
||||
|
||||
fn encode_and_write<W: Write, T: rxml::writer::TrackNamespace>(
|
||||
item: Item<'_>,
|
||||
enc: &mut Encoder<T>,
|
||||
|
|
@ -802,7 +803,7 @@ impl<'a> Iterator for ChildrenMut<'a> {
|
|||
|
||||
/// An iterator over references to child elements of an `Element`.
|
||||
pub struct ContentsAsChildren<'a> {
|
||||
iter: std::vec::Drain<'a, Node>,
|
||||
iter: alloc::vec::Drain<'a, Node>,
|
||||
}
|
||||
|
||||
impl<'a> Iterator for ContentsAsChildren<'a> {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
use std::io;
|
||||
|
||||
use std::error::Error as StdError;
|
||||
use core::{error::Error as StdError, fmt};
|
||||
|
||||
/// Our main error type.
|
||||
#[derive(Debug)]
|
||||
|
|
@ -65,8 +65,8 @@ impl From<io::Error> for Error {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Error {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Error::XmlError(e) => write!(fmt, "XML error: {}", e),
|
||||
Error::Io(e) => write!(fmt, "I/O error: {}", e),
|
||||
|
|
@ -93,4 +93,4 @@ impl From<rxml::strings::Error> for Error {
|
|||
}
|
||||
|
||||
/// Our simplified Result type.
|
||||
pub type Result<T> = ::std::result::Result<T, Error>;
|
||||
pub type Result<T> = ::core::result::Result<T, Error>;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@
|
|||
//! minidom = "*"
|
||||
//! ```
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
pub mod convert;
|
||||
pub mod element;
|
||||
pub mod error;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,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 core::fmt;
|
||||
use std::collections::BTreeMap;
|
||||
use std::fmt;
|
||||
|
||||
pub type Prefix = Option<String>;
|
||||
pub type Namespace = String;
|
||||
|
|
|
|||
Loading…
Reference in a new issue