Tracking issue for Vec::extract_if and LinkedList::extract_if · Issue #43244 · rust-lang/rust (original) (raw)

This is a tracking issue for Vec::extract_if and LinkedList::extract_if, which can be used for random deletes using iterators.

pub mod alloc { pub mod vec { impl<T, A> Vec<T, A> where A: Allocator, { pub fn extract_if(&mut self, filter: F) -> ExtractIf<'_, T, F, A> where F: FnMut(&mut T) -> bool; }

    pub struct ExtractIf<'a, T, F, #[unstable(feature = "allocator_api", issue = "32838")] A = Global>
    where
        F: FnMut(&mut T) -> bool,
        A: Allocator;

    impl<T, F, A> Iterator for ExtractIf<'_, T, F, A>
    where
        F: FnMut(&mut T) -> bool,
        A: Allocator;

    impl<T, F, A> Drop for ExtractIf<'_, T, F, A>
    where
        A: Allocator;

    impl<T, F, A> Debug for ExtractIf<'_, T, F, A>
    where
        T: Debug,
        F: Debug,
        A: Debug + Allocator;
}

pub mod collections {
    pub mod linked_list {
        impl<T, A> LinkedList<T, A>
        where
            A: Allocator,
        {
            pub fn extract_if<F>(&mut self, filter: F) -> ExtractIf<'_, T, F, A>
            where
                F: FnMut(&mut T) -> bool;
        }

        pub struct ExtractIf<'a, T, F, #[unstable(feature = "allocator_api", issue = "32838")] A = Global>
        where
            T: 'a,
            F: 'a + FnMut(&mut T) -> bool,
            A: Allocator;

        impl<T, F, A> Iterator for ExtractIf<'_, T, F, A>
        where
            F: FnMut(&mut T) -> bool,
            A: Allocator;

        impl<T, F> Debug for ExtractIf<'_, T, F, Global>
        where
            T: Debug;
    }
}

}