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

Fix missing generics on impl for EnumTryAs #337

Closed hasali19 closed 8 months ago

hasali19 commented 8 months ago

The EnumTryAs impl currently does not pass through generic parameters from the enum.

#[derive(Debug, EnumTryAs)]
    pub enum ConstantInfo<'a> {
        Utf8(bumpalo::collections::String<'a>),
    }

generates

impl ConstantInfo {
    #[must_use]
    #[inline]
    pub fn try_as_utf_8(self) -> ::core::option::Option<(bumpalo::collections::String<'a>)> {
        match self {
            ConstantInfo::Utf8(x) => Some((x)),
            _ => None,
        }
    }
    ...
}

which doesn't compile.