Skip to content

Commit 5b65147

Browse files
committed
chore: attach a bit code comment
Signed-off-by: tison <wander4096@gmail.com>
1 parent 52e23eb commit 5b65147

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

fastpool/src/retain_spec.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,20 @@ pub struct RetainResult<T> {
2626
pub removed: Vec<T>,
2727
}
2828

29+
/// An internal trait that abstracts over unbounded and bounded `ObjectState`.
2930
pub(crate) trait SealedState {
31+
/// The type of the object.
3032
type Object;
3133

34+
/// Returns the status of the object.
3235
fn status(&self) -> ObjectStatus;
36+
/// Returns a mutable reference to the object.
3337
fn mut_object(&mut self) -> &mut Self::Object;
38+
/// Returns the owned object, consuming the state.
3439
fn take_object(self) -> Self::Object;
3540
}
3641

42+
/// Shared `VecDeque`'s retain (`extract_if`) implementation for both bounded and unbounded pools.
3743
pub(crate) fn do_vec_deque_retain<T, State: SealedState<Object = T>>(
3844
deque: &mut VecDeque<State>,
3945
mut f: impl FnMut(&mut T, ObjectStatus) -> bool,

0 commit comments

Comments
 (0)