Let `oxide_auth_rocket::OAuthFailure` be a `#[non_exhaustive]` enum
- Linguagem predominante
- Rust
- Estrelas
- 783
- Forks
- 102
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
# Project Improvement
Currently `oxide_auth_rocket::OAuthFailure` is a struct with a private inner field `Kind` which one can retrieve variants from via the `oauth()` and `web()` methods. If you want to roll your own error type (since `OAuthFailure` is not stable) you have to do some cumbersome matching that feels a bit un-rusty:
```
if let Some(web_failure) = failure.web() {
//...
} else if let Some(oauth_failure) = failure.oauth() {
//...
}
```
Turning the failure type into a non-exhaustive enum would allow users to match on the enum instead of having to call functions while still allowing the project to add new failure modes.
## Other context
It just feels like a more ergonomic interface to use.
# Tracking pull request
- [ ] A pull request does not yet exist, I could create it if this seems like a reasonable request.
Guia de contribuição
Direção de pesquisa
Observe a definição de OAuthFailure no módulo oxide_auth_rocket. Entenda seu layout de struct atual e o campo privado Kind. A alteração envolve convertê-lo em um enum não exaustivo, atualizar seus métodos e garantir que o código a jusante ainda seja compilado. Verifique se há testes que possam precisar de atualização e confirme que a alteração não quebre as garantias de estabilidade da API pública.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Domínio
- backend-api-design
- Tipo de issue
- Refatoração
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 65/100