Loading src/rust/protover/protoset.rs +0 −30 Original line number Diff line number Diff line Loading @@ -242,36 +242,6 @@ impl ProtoSet { false } /// Retain only the `Version`s in this `ProtoSet` for which the predicate /// `F` returns `true`. /// /// # Examples /// /// ``` /// # use protover::errors::ProtoverError; /// use protover::protoset::ProtoSet; /// /// # fn do_test() -> Result<bool, ProtoverError> { /// let mut protoset: ProtoSet = "1,3-5,9".parse()?; /// /// // Keep only versions less than or equal to 8: /// protoset.retain(|x| x <= &8); /// /// assert_eq!(protoset.expand(), vec![1, 3, 4, 5]); /// # /// # Ok(true) /// # } /// # fn main() { do_test(); } // wrap the test so we can use the ? operator /// ``` // XXX we could probably do something more efficient here. —isis pub fn retain<F>(&mut self, f: F) where F: FnMut(&Version) -> bool { let mut expanded: Vec<Version> = self.clone().expand(); expanded.retain(f); *self = expanded.into(); } /// Returns all the `Version`s in `self` which are not also in the `other` /// `ProtoSet`. /// Loading Loading
src/rust/protover/protoset.rs +0 −30 Original line number Diff line number Diff line Loading @@ -242,36 +242,6 @@ impl ProtoSet { false } /// Retain only the `Version`s in this `ProtoSet` for which the predicate /// `F` returns `true`. /// /// # Examples /// /// ``` /// # use protover::errors::ProtoverError; /// use protover::protoset::ProtoSet; /// /// # fn do_test() -> Result<bool, ProtoverError> { /// let mut protoset: ProtoSet = "1,3-5,9".parse()?; /// /// // Keep only versions less than or equal to 8: /// protoset.retain(|x| x <= &8); /// /// assert_eq!(protoset.expand(), vec![1, 3, 4, 5]); /// # /// # Ok(true) /// # } /// # fn main() { do_test(); } // wrap the test so we can use the ? operator /// ``` // XXX we could probably do something more efficient here. —isis pub fn retain<F>(&mut self, f: F) where F: FnMut(&Version) -> bool { let mut expanded: Vec<Version> = self.clone().expand(); expanded.retain(f); *self = expanded.into(); } /// Returns all the `Version`s in `self` which are not also in the `other` /// `ProtoSet`. /// Loading