Make serde usable in no_std
This commit is contained in:
parent
e7155f153d
commit
ca53ee34a8
|
@ -45,7 +45,7 @@ rand_core = "0.4.0"
|
||||||
|
|
||||||
unicode-normalization = { version = "=0.1.9", optional = true }
|
unicode-normalization = { version = "=0.1.9", optional = true }
|
||||||
rand = { version = "0.6.0", optional = true }
|
rand = { version = "0.6.0", optional = true }
|
||||||
serde = { version = "1.0", default-features = false, optional = true }
|
serde = { version = "1.0", default-features = false, features = [ "alloc" ], optional = true }
|
||||||
# Enabling this feature raises the MSRV to 1.51
|
# Enabling this feature raises the MSRV to 1.51
|
||||||
zeroize = {version = "1.5", features = ["zeroize_derive"], optional = true}
|
zeroize = {version = "1.5", features = ["zeroize_derive"], optional = true}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,9 @@ macro_rules! serde_string_impl {
|
||||||
where
|
where
|
||||||
D: $crate::serde::de::Deserializer<'de>,
|
D: $crate::serde::de::Deserializer<'de>,
|
||||||
{
|
{
|
||||||
use std::fmt::{self, Formatter};
|
use core::fmt::{self, Formatter};
|
||||||
use std::str::FromStr;
|
use core::str::FromStr;
|
||||||
|
use alloc::string::String;
|
||||||
|
|
||||||
struct Visitor;
|
struct Visitor;
|
||||||
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
|
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#[cfg(any(test, feature = "std"))]
|
#[cfg(any(test, feature = "std"))]
|
||||||
pub extern crate core;
|
pub extern crate core;
|
||||||
|
|
||||||
|
extern crate alloc;
|
||||||
|
|
||||||
extern crate bitcoin_hashes;
|
extern crate bitcoin_hashes;
|
||||||
extern crate rand_core;
|
extern crate rand_core;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue