Provide ops::Range impls whether or not std is used
This commit is contained in:
parent
28db9d4989
commit
228b5a4a63
@ -9,12 +9,10 @@
|
|||||||
use lib::*;
|
use lib::*;
|
||||||
|
|
||||||
use de::{
|
use de::{
|
||||||
Deserialize, Deserializer, EnumAccess, Error, SeqAccess, Unexpected, VariantAccess, Visitor,
|
Deserialize, Deserializer, EnumAccess, Error, MapAccess, SeqAccess, Unexpected, VariantAccess,
|
||||||
|
Visitor,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(any(core_duration, feature = "std", feature = "alloc"))]
|
|
||||||
use de::MapAccess;
|
|
||||||
|
|
||||||
use de::from_primitive::FromPrimitive;
|
use de::from_primitive::FromPrimitive;
|
||||||
use private::de::InPlaceSeed;
|
use private::de::InPlaceSeed;
|
||||||
|
|
||||||
@ -2054,8 +2052,7 @@ impl<'de> Deserialize<'de> for SystemTime {
|
|||||||
// start: u64,
|
// start: u64,
|
||||||
// end: u32,
|
// end: u32,
|
||||||
// }
|
// }
|
||||||
#[cfg(feature = "std")]
|
impl<'de, Idx> Deserialize<'de> for Range<Idx>
|
||||||
impl<'de, Idx> Deserialize<'de> for ops::Range<Idx>
|
|
||||||
where
|
where
|
||||||
Idx: Deserialize<'de>,
|
Idx: Deserialize<'de>,
|
||||||
{
|
{
|
||||||
@ -2105,7 +2102,7 @@ where
|
|||||||
b"start" => Ok(Field::Start),
|
b"start" => Ok(Field::Start),
|
||||||
b"end" => Ok(Field::End),
|
b"end" => Ok(Field::End),
|
||||||
_ => {
|
_ => {
|
||||||
let value = String::from_utf8_lossy(value);
|
let value = ::export::from_utf8_lossy(value);
|
||||||
Err(Error::unknown_field(&value, FIELDS))
|
Err(Error::unknown_field(&value, FIELDS))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2124,7 +2121,7 @@ where
|
|||||||
where
|
where
|
||||||
Idx: Deserialize<'de>,
|
Idx: Deserialize<'de>,
|
||||||
{
|
{
|
||||||
type Value = ops::Range<Idx>;
|
type Value = Range<Idx>;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
formatter.write_str("struct Range")
|
formatter.write_str("struct Range")
|
||||||
|
@ -155,7 +155,7 @@ mod lib {
|
|||||||
pub use std::*;
|
pub use std::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use self::core::{cmp, iter, mem, num, ops, slice, str};
|
pub use self::core::{cmp, iter, mem, num, slice, str};
|
||||||
pub use self::core::{f32, f64};
|
pub use self::core::{f32, f64};
|
||||||
pub use self::core::{i16, i32, i64, i8, isize};
|
pub use self::core::{i16, i32, i64, i8, isize};
|
||||||
pub use self::core::{u16, u32, u64, u8, usize};
|
pub use self::core::{u16, u32, u64, u8, usize};
|
||||||
@ -166,6 +166,7 @@ mod lib {
|
|||||||
pub use self::core::default::{self, Default};
|
pub use self::core::default::{self, Default};
|
||||||
pub use self::core::fmt::{self, Debug, Display};
|
pub use self::core::fmt::{self, Debug, Display};
|
||||||
pub use self::core::marker::{self, PhantomData};
|
pub use self::core::marker::{self, PhantomData};
|
||||||
|
pub use self::core::ops::Range;
|
||||||
pub use self::core::option::{self, Option};
|
pub use self::core::option::{self, Option};
|
||||||
pub use self::core::result::{self, Result};
|
pub use self::core::result::{self, Result};
|
||||||
|
|
||||||
|
@ -227,8 +227,7 @@ seq_impl!(VecDeque<T>);
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
impl<Idx> Serialize for Range<Idx>
|
||||||
impl<Idx> Serialize for ops::Range<Idx>
|
|
||||||
where
|
where
|
||||||
Idx: Serialize,
|
Idx: Serialize,
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user