From a164f523155f359757e3e908f5d469c0ab4e8ea7 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 16 Feb 2018 08:17:30 +0100 Subject: [PATCH 1/2] Update README.md Add some information about ```no_std``` because it was not obvious to me --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 21378d88..7560c616 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,16 @@ about Serde. If IRC is not your thing or you don't get a good response, we are happy to respond to [GitHub issues](https://github.com/serde-rs/serde/issues/new) as well. +## no-std +Serde has a feature named std enabled by default. +In order to to use Serde in a no_std context the std feature has to be disabled. +To do that add the following to your Cargo.toml: + +``` +[dependencies] +serde = { version = "1.0.27", default-features = false } +``` + ## License Serde is licensed under either of From f9946ee0cab7b5bdbc1566ef96e6c1bf44e88a2c Mon Sep 17 00:00:00 2001 From: niklasad1 Date: Sat, 17 Feb 2018 10:03:21 +0100 Subject: [PATCH 2/2] add some comments about alloc in no_std --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7560c616..aca45e35 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ happy to respond to [GitHub issues](https://github.com/serde-rs/serde/issues/new as well. ## no-std -Serde has a feature named std enabled by default. +Serde has a feature named std enabled by default. In order to to use Serde in a no_std context the std feature has to be disabled. To do that add the following to your Cargo.toml: @@ -94,6 +94,14 @@ To do that add the following to your Cargo.toml: serde = { version = "1.0.27", default-features = false } ``` +Also, note that this implies that there is no memory allocator enabled by +default. Therefore, if you have access to heap memory and want to use modules +from the standard library such as String, Vec or similar you need to explicitly +define which memory allocator to use. There are a number of different memory +allocators available for that, for example +[alloc](https://doc.rust-lang.org/nightly/alloc/index.html) that the standard +library in Rust is using. + ## License Serde is licensed under either of