Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix serde and decode features without default features #74

Merged
merged 4 commits into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ jobs:
cargo clippy --version
cargo clippy --all -- -D warnings
- name: check-all-features
run: |
cargo generate-lockfile --verbose && cargo update -p funty --precise "1.1.0" --verbose
cargo check --all --all-features
- name: check-features
run: |
cargo generate-lockfile --verbose && cargo update -p funty --precise "1.1.0" --verbose
cargo check --no-default-features --features serde
cargo check --no-default-features --features serde,decode
- name: build
run: |
cargo generate-lockfile --verbose && cargo update -p funty --precise "1.1.0" --verbose
Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ derive = [
"scale-info-derive"
]
# enables decoding and deserialization of portable scale-info type metadata
decode = []
decode = [
"scale/full"
]

[workspace]
members = [
Expand Down
8 changes: 2 additions & 6 deletions src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ use crate::{
Type,
};
use scale::Encode;
#[cfg(feature = "serde")]
use serde::{
Deserialize,
Serialize,
};

/// Convert the type definition into the portable form using a registry.
pub trait IntoPortable {
Expand Down Expand Up @@ -165,7 +160,8 @@ impl Registry {
}

/// A read-only registry containing types in their portable form for serialization.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(all(feature = "serde", feature = "decode"), derive(serde::Deserialize))]
#[cfg_attr(any(feature = "std", feature = "decode"), derive(scale::Decode))]
#[derive(Clone, Debug, PartialEq, Eq, Encode)]
pub struct PortableRegistry {
Expand Down
4 changes: 2 additions & 2 deletions test_suite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ license = "Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
scale-info = { path = "..", features = ["derive", "serde"] }
scale-info = { path = "..", features = ["derive", "serde", "decode"] }

scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale = { package = "parity-scale-codec", version = "2.0.1", default-features = false, features = ["derive"] }
serde = "1.0"
serde_json = "1.0"
pretty_assertions = "0.6.1"
Expand Down