File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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`.
2930pub ( 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.
3743pub ( 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 ,
You can’t perform that action at this time.
0 commit comments