dylanhart / ulid-rs

This is a Rust implementation of the ulid project

Home Page:https://crates.io/crates/ulid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to compile the combination of `no_std` and the `serde` feature

TimLuq opened this issue · comments

Since the serde.rs file expects String to be made available by the prelude the compilation fails if serde is activated without std.

> cargo build
   Compiling ulid v1.0.0
error[E0433]: failed to resolve: use of undeclared type `String`
  --> ulid-1.0.0/src/serde.rs:28:32
   |
28 |         let deserialized_str = String::deserialize(deserializer)?;
   |                                ^^^^^^ use of undeclared type `String`

I propose that when the std feature is used it will depend on serde?/std and by default the optional serde dependency has { default-features = false, features = ["alloc", "derive"] }. I'll make a PR for this sometimes this coming week if no one else beats me to it.