add no_std support (#42)

* Metadata supporting scale-info can be decoded and serialized in no_std (#2)

* Metadata supporting scale-info can be decoded and serialized in no_std (feature flag scale_info)

* Changes from review: rename feature flag into full_derive

* Changes from review: std implies full-derive

* Changes from review: optimization

Co-authored-by: echevrier <edith.chevrier@scs.ch>

* split full_derive into decode and sered_codec features.

(drop new Debug impls)

* cargo fmt

* rename serde_codec to serde_full

* Prior to v14 everything was Debug.

Are there any downsides? Unused debug impls will just get optimised away won't they?

* rust fmt

* Debug for the masses. Make it work for no_std

* check all combos of features

(if this plays well with ci then we should double up,
doing the same again but target wasm32)

* all wasm feature combos

Co-authored-by: echevrier <84318241+echevrier@users.noreply.github.com>
Co-authored-by: echevrier <edith.chevrier@scs.ch>
This commit is contained in:
Squirrel
2022-11-09 14:32:34 +00:00
committed by GitHub
parent d41046b12c
commit 1ea3299208
9 changed files with 253 additions and 225 deletions
+14 -4
View File
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
cfg-if = "1.0.0"
scale-info = { version = "2.0.0", default-features = false, optional = true, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] }
serde = { version = "1.0.101", default-features = false, optional = true, features = ["derive"] }
[features]
default = ["std", "v14"]
@@ -28,10 +28,20 @@ v12 = []
v13 = []
legacy = ["v13", "v12", "v11", "v10", "v9", "v8"]
v14 = ["scale-info"]
# Serde support without relying on std features
serde_full = [
"scale-info/serde",
"serde",
"serde/alloc",
]
# Scale decode support without relying on std features
decode = ["scale-info/decode"]
std = [
"decode",
"serde_full",
"codec/std",
"scale-info/std",
"scale-info/serde",
"scale-info/decode",
"serde",
"serde/std",
]