Skip to content

Commit

Permalink
docs: note drop behavior for Drain and DrainFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg authored and cberner committed Sep 6, 2023
1 parent 5dde756 commit e5798e7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ impl<'db, 'txn, K: RedbKey + 'static, V: RedbValue + 'static> Table<'db, 'txn, K
}

/// Removes the specified range and returns the removed entries in an iterator
///
/// The iterator will consume all items in the range on drop.
pub fn drain<'a, KR>(&mut self, range: impl RangeBounds<KR> + 'a) -> Result<Drain<K, V>>
where
K: 'a,
Expand All @@ -87,6 +89,8 @@ impl<'db, 'txn, K: RedbKey + 'static, V: RedbValue + 'static> Table<'db, 'txn, K

/// Applies `predicate` to all key-value pairs in the specified range. All entries for which
/// `predicate` evaluates to `true` are removed and returned in an iterator
///
/// The iterator will consume all items in the range matching the predicate on drop.
pub fn drain_filter<'a, KR, F: for<'f> Fn(K::SelfType<'f>, V::SelfType<'f>) -> bool>(
&mut self,
range: impl RangeBounds<KR> + 'a,
Expand Down

0 comments on commit e5798e7

Please sign in to comment.