From 647e860a2c3e3983d226ce02cfdf665a65622faf Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 6 Sep 2023 13:15:09 +0200 Subject: [PATCH] im-util: Remove VectorExt It doesn't match the upcoming changes to VectorSubscriber. --- eyeball-im-util/src/lib.rs | 2 -- eyeball-im-util/src/vector.rs | 46 ----------------------------------- 2 files changed, 48 deletions(-) diff --git a/eyeball-im-util/src/lib.rs b/eyeball-im-util/src/lib.rs index c750a60..feca1c0 100644 --- a/eyeball-im-util/src/lib.rs +++ b/eyeball-im-util/src/lib.rs @@ -3,5 +3,3 @@ //! The primary entry point of this library is [`VectorExt`]. pub mod vector; - -pub use vector::VectorExt; diff --git a/eyeball-im-util/src/vector.rs b/eyeball-im-util/src/vector.rs index 6dbc046..12173aa 100644 --- a/eyeball-im-util/src/vector.rs +++ b/eyeball-im-util/src/vector.rs @@ -1,51 +1,5 @@ //! Utilities around [`ObservableVector`]. -use eyeball_im::{ObservableVector, Vector, VectorSubscriber}; - mod filter; pub use self::filter::{Filter, FilterMap}; - -/// Extension trait for [`ObservableVector`]. -pub trait VectorExt -where - T: Clone + Send + Sync + 'static, -{ - /// Obtain a new subscriber that filters items by the given filter function. - /// - /// Returns a filtered version of the current vector, and a subscriber to - /// get updates through. - fn subscribe_filter(&self, f: F) -> (Vector, Filter, F>) - where - F: Fn(&T) -> bool; - - /// Obtain a new subscriber that filters and maps items with the given - /// function. - /// - /// Returns a filtered + mapped version of the current vector, and a - /// subscriber to get updates through. - fn subscribe_filter_map(&self, f: F) -> (Vector, FilterMap, F>) - where - U: Clone, - F: Fn(T) -> Option; -} - -impl VectorExt for ObservableVector -where - T: Clone + Send + Sync + 'static, -{ - fn subscribe_filter(&self, f: F) -> (Vector, Filter, F>) - where - F: Fn(&T) -> bool, - { - Filter::new((*self).clone(), self.subscribe(), f) - } - - fn subscribe_filter_map(&self, f: F) -> (Vector, FilterMap, F>) - where - U: Clone, - F: Fn(T) -> Option, - { - FilterMap::new((*self).clone(), self.subscribe(), f) - } -}