From e5798e763c5edc66c6995754e498fb1b5f5d8438 Mon Sep 17 00:00:00 2001 From: Oliver Nordbjerg Date: Tue, 5 Sep 2023 13:32:44 +0200 Subject: [PATCH] docs: note drop behavior for `Drain` and `DrainFilter` --- src/table.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/table.rs b/src/table.rs index 060f0d1d..38723687 100644 --- a/src/table.rs +++ b/src/table.rs @@ -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 + 'a) -> Result> where K: 'a, @@ -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 + 'a,