Related: #29
This crate seems very useful to me, but unfortunately it provides no way to derive const constructors, and because of that I cannot use it for my project. I can't think why this wouldn't be the default, but nonetheless, an opt-in feature flag perhaps would be really helpful.
I would like to be able to use the constructors like so:
pub struct Atom(u32);
pub const PRIMARY: Atom = Atom::new(1);
pub const SECONDARY: Atom = Atom::new(2);
pub const ARC: Atom = Atom::new(3);
pub const ATOM: Atom = Atom::new(4);
pub const BITMAP: Atom = Atom::new(5);
Where Atom is used in implementing a protocol that pre-defines these constants with the corresponding IDs. That means using a const fn like so:
impl Atom {
#[must_use]
pub const fn new(id: u32) -> Self {
Self(id)
}
}
Related: #29
This crate seems very useful to me, but unfortunately it provides no way to derive
constconstructors, and because of that I cannot use it for my project. I can't think why this wouldn't be the default, but nonetheless, an opt-in feature flag perhaps would be really helpful.I would like to be able to use the constructors like so:
Where
Atomis used in implementing a protocol that pre-defines these constants with the corresponding IDs. That means using aconst fnlike so: