Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Reserver does not need to be generic

未關閉 適合新手
#195 0 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 2 天內回覆

@jerbaroo 已經在處理了。

開始於 2026年10月16日。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
72/100
Issue 類型
重構
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
rust
領域
backend

研究方向

從 issue 中引用的 Reserver 結構體及其 Debug 與固有 impl 區塊開始,然後找到 Reserver<ChunkId, ChunkId> 被建構與使用的位置。移除型別參數,使欄位 reservations 與 pending_removals 直接使用 ChunkId,並相應更新 impl 區塊與呼叫位置。當 crate 能通過 cargo check 編譯,且既有測試能通過 cargo test 時,即視為完成。

由索引模型根據 Issue 內容生成。

描述

The Reserver<K,V> currently has two type parameters, but is only ever created as Reserver<ChunkId, ChunkId>. Removing the type parameters and making the Reserver non-generic will make it more simple.

The current generic code:

pub struct Reserver<K, V> {
    reservations: Cache<K, (V, UnboundedSender<V>, Instant), FxBuildHasher>,
    pending_removals: Arc<Mutex<DelayQueue<K>>>,
}

impl<K, V> core::fmt::Debug for Reserver<K, V>
where
    K: Hash + Eq + Send + Sync + Debug + Copy + 'static,
    V: Send + Sync + Clone + Debug + 'static,
{
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("Reserver")
            .field("reservations", &self.reservations)
            .field("&pending_removals", &self.pending_removals)
            .finish()
    }
}

impl<K, V> Reserver<K, V>
where
    K: Hash + Eq + Send + Sync + Debug + Copy + 'static,
    V: Send + Sync + Clone + 'static,
主要語言
Rust
星號
96
分支
2
平均合併
8 天 22 小時
30 天內合併 PR
2

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

channable/opsqueue 的其他 Issue

查看 channable/opsqueue 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。