AldaronLau / AldaronLau/as_repr
idea: Newtype wrapper for open enums
Aberta
- Linguagem predominante
- Rust
- Estrelas
- 1
- Forks
- 0
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
`AsReprInherent` creates the possibility of a newtype adapter to create an open type (all bit patterns valid) from a closed type (some bit patterns invalid):
```rust
#[repr(transparent)]
pub struct Open(pub T::InherentRepr)
where
T: AsReprInherent,
::InherentRepr: Integer;
```
Could automatically get `TryFrom> for T where T: TryFromRepr {}` and `From for Open where T: ReprFrom`
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.