Unable to use validation in no-std crate
TheBestTvarynka opened this issue · comments
Hi,
I'm trying to write a small new type struct with a simple validation in the no-std
crate. My current code looks like this:
#[nutype(
validate(less = 13),
derive(Debug, Clone, PartialEq, Eq)
)]
pub struct Month(u8);
But unfortunately, I got the following error:
error[E0433]: failed to resolve: could not find `std` in the list of imported crates
--> src/lib.rs:7:1
|
7 | / #[nutype(
8 | | validate(less = 100),
9 | | derive(Debug, Clone, PartialEq, Eq)
10 | | )]
| |__^ could not find `std` in the list of imported crates
|
= help: consider importing one of these items:
crate::__nutype_private_Year__::core::error
core::error
= note: this error originates in the attribute macro `nutype` (in Nightly builds, run with -Z macro-backtrace for more info)
Is it a bug or just expected behavior?
Thanks in advance
@TheBestTvarynka Thanks for the report.
Generally I tried to use ::core
as much as possible instead of ::std
but I did not test it for real with no-std
.
I think supporting no-std
should be possible with a bit of work / tuning.
@TheBestTvarynka I just published 0.4.1-beta.1
, please give it a try.
Note:
String
type is still not supported inno_std
environment.- Use
default-features = false
fornutype
dependency
@greyblake yes, it works now. thank you