Peternator7 / strum

A small rust library for adding custom derives to enums
https://crates.io/crates/strum
MIT License
1.8k stars 151 forks source link

No support when using #![no_std] #373

Open aaalloc opened 3 months ago

aaalloc commented 3 months ago

Cargo.toml

strum = { version = "0.26.3", features = ["derive"] }

During compilation

.....
error[E0463]: can't find crate for `std`
...
  = note: `std` is required by `strum` because it does not declare `#![no_std]`

 error: cannot find attribute `derive` in this scope
  --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:41:3
   |
41 | #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
   |   ^^^^^^
   |
help: consider importing this attribute macro
   |
33 + use core::prelude::rust_2024::derive;
   |

error: cannot find macro `write` in this scope
  --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:52:44
   |
52 |             ParseError::VariantNotFound => write!(f, "Matching variant not found"),
   |                                            ^^^^^
   |
help: consider importing this macro
   |
33 + use core::write;
   |

error[E0463]: can't find crate for `std`
  --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:47:6
   |
47 | impl std::fmt::Display for ParseError {
   |      ^^^ can't find crate
   |
   = note: the `riscv64gc-unknown-none-elf` target may not support the standard library
   = help: consider building the standard library from source with `cargo build -Zbuild-std`

error[E0463]: can't find crate for `std`
  --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:48:27
   |
48 |     fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
   |                           ^^^ can't find crate
   |
   = note: the `riscv64gc-unknown-none-elf` target may not support the standard library
   = help: consider building the standard library from source with `cargo build -Zbuild-std`

error[E0463]: can't find crate for `std`
  --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:48:62
   |
48 |     fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
   |                                                              ^^^ can't find crate
   |
   = note: the `riscv64gc-unknown-none-elf` target may not support the standard library
   = help: consider building the standard library from source with `cargo build -Zbuild-std`

error[E0463]: can't find crate for `std`
  --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:58:6
   |
58 | impl std::error::Error for ParseError {
   |      ^^^ can't find crate
   |
   = note: the `riscv64gc-unknown-none-elf` target may not support the standard library
   = help: consider building the standard library from source with `cargo build -Zbuild-std`

error[E0412]: cannot find type `Result` in this scope
  --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:48:51
   |
48 |     fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
   |                                                   ^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
33 + use core::fmt::Result;
   |
33 + use core::result::Result;
   |

error[E0405]: cannot find trait `Sized` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:100:29
    |
100 | pub trait IntoEnumIterator: Sized {
    |                             ^^^^^ not found in this scope
    |
help: consider importing this trait
    |
33  + use core::marker::Sized;
    |

error[E0405]: cannot find trait `Iterator` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:101:20
    |
101 |     type Iterator: Iterator<Item = Self>
    |                    ^^^^^^^^
    |
help: you might have meant to use the associated type
    |
101 |     type Iterator: Self::Iterator<Item = Self>
    |                    ++++++
help: consider importing this trait
    |
33  + use core::iter::Iterator;
    |

error[E0405]: cannot find trait `Clone` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:102:11
    |
102 |         + Clone
    |           ^^^^^ not found in this scope
    |
help: consider importing this trait
    |
33  + use core::clone::Clone;
    |

error[E0405]: cannot find trait `DoubleEndedIterator` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:103:11
    |
103 |         + DoubleEndedIterator
    |           ^^^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing this trait
    |
33  + use core::iter::DoubleEndedIterator;
    |

error[E0405]: cannot find trait `ExactSizeIterator` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:104:11
    |
104 |         + ExactSizeIterator
    |           ^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing this trait
    |
33  + use core::iter::ExactSizeIterator;
    |

error[E0405]: cannot find trait `Sized` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:110:28
    |
110 | pub trait VariantIterator: Sized {
    |                            ^^^^^ not found in this scope
    |
help: consider importing this trait
    |
33  + use core::marker::Sized;
    |

error[E0405]: cannot find trait `Iterator` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:111:20
    |
111 |     type Iterator: Iterator<Item = Self>;
    |                    ^^^^^^^^
    |
help: you might have meant to use the associated type
    |
111 |     type Iterator: Self::Iterator<Item = Self>;
    |                    ++++++
help: consider importing this trait
    |
33  + use core::iter::Iterator;
    |

error[E0412]: cannot find type `Option` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:148:30
    |
148 |     fn get_message(&self) -> Option<&'static str>;
    |                              ^^^^^^ not found in this scope
    |
help: consider importing this enum
    |
33  + use core::option::Option;
    |

error[E0412]: cannot find type `Option` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:149:39
    |
149 |     fn get_detailed_message(&self) -> Option<&'static str>;
    |                                       ^^^^^^ not found in this scope
    |
help: consider importing this enum
    |
33  + use core::option::Option;
    |

error[E0412]: cannot find type `Option` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:152:36
    |
152 |     fn get_documentation(&self) -> Option<&'static str>;
    |                                    ^^^^^^ not found in this scope
    |
help: consider importing this enum
    |
33  + use core::option::Option;
    |

error[E0412]: cannot find type `Option` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:184:38
    |
184 |     fn get_str(&self, prop: &str) -> Option<&'static str>;
    |                                      ^^^^^^ not found in this scope
    |
help: consider importing this enum
    |
33  + use core::option::Option;
    |

error[E0412]: cannot find type `Option` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:185:39
    |
185 |     fn get_int(&self, _prop: &str) -> Option<usize> {
    |                                       ^^^^^^ not found in this scope
    |
help: consider importing this enum
    |
33  + use core::option::Option;
    |

error[E0433]: failed to resolve: use of undeclared type `Option`
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:186:9
    |
186 |         Option::None
    |         ^^^^^^ use of undeclared type `Option`
    |
help: consider importing this enum
    |
33  + use core::option::Option;
    |

error[E0412]: cannot find type `Option` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:189:40
    |
189 |     fn get_bool(&self, _prop: &str) -> Option<bool> {
    |                                        ^^^^^^ not found in this scope
    |
help: consider importing this enum
    |
33  + use core::option::Option;
    |

error[E0433]: failed to resolve: use of undeclared type `Option`
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:190:9
    |
190 |         Option::None
    |         ^^^^^^ use of undeclared type `Option`
    |
help: consider importing this enum
    |
33  + use core::option::Option;
    |

error[E0405]: cannot find trait `Sized` in this scope
   --> /home/yanovskyy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strum-0.26.3/src/lib.rs:202:9
    |
202 |     T: ?Sized,
    |         ^^^^^ not found in this scope
    |
help: consider importing this trait
    |
33  + use core::marker::Sized;

any solution to migate that ?