Skip to content

Commit 538f008

Browse files
authored
Merge pull request #209 from greyblake/no-std-deserialize-ci-test
Add a test to ensure Deserialize can be derived in no_std env
2 parents 2b27a71 + ace3bcd commit 538f008

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

examples/no_std_example/Cargo.lock

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/no_std_example/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
nutype = { path = "../../nutype", default-features = false }
9+
nutype = { path = "../../nutype", default-features = false, features = ["serde"] }
10+
serde = { version = "1.0", default-features = false }
1011

1112
# Exclude this package from the common workspace, since it's no_std.
1213
[workspace]

examples/no_std_example/src/main.rs

+6
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,9 @@ pub struct Point {
7272
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, AsRef, Into, From, Deref, Borrow, Hash
7373
))]
7474
pub struct Location(Point);
75+
76+
#[nutype(
77+
validate(less_or_equal = 100),
78+
derive(Serialize, Deserialize)
79+
)]
80+
pub struct Percentage(u8);

0 commit comments

Comments
 (0)