Let `oxide_auth_rocket::OAuthFailure` be a `#[non_exhaustive]` enum
- 主要語言
- Rust
- 星號
- 783
- 分支
- 102
- PR 合併指標
- 30 天內沒有已合併 PR
描述
# 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.
貢獻指南
研究方向
查看 oxide_auth_rocket 模組中 OAuthFailure 的定義。理解其當前的結構體佈局和私有的 Kind 欄位。此更改涉及將其轉換為非窮舉列舉,更新其方法,並確保下游程式碼仍能編譯。檢查是否有需要更新的測試,並驗證此更改不會破壞公共 API 的穩定性保證。
由索引模型根據 Issue 內容生成。
評估
- 領域
- backend-api-design
- Issue 類型
- 重構
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 65/100