Skip to content

Commit

Permalink
Merge pull request #209 from greyblake/no-std-deserialize-ci-test
Browse files Browse the repository at this point in the history
Add a test to ensure Deserialize can be derived in no_std env
  • Loading branch information
greyblake authored Feb 9, 2025
2 parents 2b27a71 + ace3bcd commit 538f008
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
21 changes: 21 additions & 0 deletions examples/no_std_example/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion examples/no_std_example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
nutype = { path = "../../nutype", default-features = false }
nutype = { path = "../../nutype", default-features = false, features = ["serde"] }
serde = { version = "1.0", default-features = false }

# Exclude this package from the common workspace, since it's no_std.
[workspace]
6 changes: 6 additions & 0 deletions examples/no_std_example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ pub struct Point {
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, AsRef, Into, From, Deref, Borrow, Hash
))]
pub struct Location(Point);

#[nutype(
validate(less_or_equal = 100),
derive(Serialize, Deserialize)
)]
pub struct Percentage(u8);

0 comments on commit 538f008

Please sign in to comment.