pub struct OwnerTable {
map: BTreeMap<String, Entry>,
}Expand description
URL → 持ち主の組と段階。
Fields§
§map: BTreeMap<String, Entry>Implementations§
Source§impl OwnerTable
impl OwnerTable
pub const fn new() -> Self
pub fn is_empty(&self) -> bool
Sourcepub fn request(&mut self, key: &str, g: u8) -> bool
pub fn request(&mut self, key: &str, g: u8) -> bool
組 g が key を求めた。初めての URL なら真(呼び出し側が待ち行列へ積む)、
既に表にあれば持ち主に g を足して偽(重複を省く)。
Sourcepub fn finish(&mut self, key: &str) -> bool
pub fn finish(&mut self, key: &str) -> bool
取得を終えた。持ち主がまだ居れば Done にして真(結果を使う)。
持ち主が居なければ表から外して偽(結果を捨てる。開き直したときにまた積めるように)。
Sourcepub fn requeue(&mut self, key: &str) -> bool
pub fn requeue(&mut self, key: &str) -> bool
取れなかったので待ち行列へ戻す。持ち主がまだ居れば Pending にして真、居なければ表から外して偽(戻さない)。
Sourcepub fn sole_owner<'a>(&self, keys: impl IntoIterator<Item = &'a str>) -> u8
pub fn sole_owner<'a>(&self, keys: impl IntoIterator<Item = &'a str>) -> u8
keys をまとめて取るときに借りる組: 持ち主がただ 1 つの組(0 以外)なら、その番号。
持ち主が複数・組 0 を含む・表に無いなら 0(借りない。止めたアプリの合図で取得を打ち切らない)。
Sourcepub fn close_group(&mut self, g: u8) -> Closed
pub fn close_group(&mut self, g: u8) -> Closed
組 g が閉じた(そのアプリが止められた)。持ち主から g を外し、持ち主が居なくなった URL を片付ける。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OwnerTable
impl RefUnwindSafe for OwnerTable
impl Send for OwnerTable
impl Sync for OwnerTable
impl Unpin for OwnerTable
impl UnsafeUnpin for OwnerTable
impl UnwindSafe for OwnerTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more