Use no-std-compat to build no-std.

This commit is contained in:
Stephen Chung
2021-04-17 15:15:54 +08:00
parent 2f2b7403cb
commit 01f0cc028b
48 changed files with 293 additions and 293 deletions

View File

@@ -1,8 +1,10 @@
//! Implementations of [`serde::Deserialize`].
use crate::stdlib::{fmt, string::ToString};
use crate::{Dynamic, ImmutableString, INT};
use serde::de::{Deserialize, Deserializer, Error, Visitor};
use std::fmt;
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
#[cfg(not(feature = "no_index"))]
use crate::Array;
@@ -95,8 +97,8 @@ impl<'d> Visitor<'d> for DynamicVisitor {
#[cfg(feature = "no_float")]
#[cfg(feature = "decimal")]
fn visit_f32<E: Error>(self, v: f32) -> Result<Self::Value, E> {
use crate::stdlib::convert::TryFrom;
use rust_decimal::Decimal;
use std::convert::TryFrom;
Decimal::try_from(v)
.map(|v| v.into())
@@ -105,8 +107,8 @@ impl<'d> Visitor<'d> for DynamicVisitor {
#[cfg(feature = "no_float")]
#[cfg(feature = "decimal")]
fn visit_f64<E: Error>(self, v: f64) -> Result<Self::Value, E> {
use crate::stdlib::convert::TryFrom;
use rust_decimal::Decimal;
use std::convert::TryFrom;
Decimal::try_from(v)
.map(|v| v.into())