From 903ea3546f853486e6b13d6770e23d10ed2e7c70 Mon Sep 17 00:00:00 2001 From: Frank McSherry Date: Mon, 27 May 2024 10:10:54 -0400 Subject: [PATCH] Remove 'static requirement from difference traits --- dogsdogsdogs/src/calculus.rs | 4 +-- dogsdogsdogs/src/lib.rs | 2 +- dogsdogsdogs/src/operators/half_join.rs | 2 +- dogsdogsdogs/src/operators/lookup_map.rs | 2 +- src/collection.rs | 16 +++++------ src/consolidation.rs | 4 +-- src/difference.rs | 4 +-- src/dynamic/mod.rs | 2 +- src/input.rs | 14 +++++----- src/operators/arrange/arrangement.rs | 8 +++--- src/operators/count.rs | 6 ++--- src/operators/iterate.rs | 8 +++--- src/operators/join.rs | 28 +++++++++---------- src/operators/reduce.rs | 28 +++++++++---------- src/operators/threshold.rs | 10 +++---- src/trace/implementations/mod.rs | 34 +++++++++++------------- src/trace/mod.rs | 2 +- 17 files changed, 85 insertions(+), 89 deletions(-) diff --git a/dogsdogsdogs/src/calculus.rs b/dogsdogsdogs/src/calculus.rs index e0ce2b6bf..16546f226 100644 --- a/dogsdogsdogs/src/calculus.rs +++ b/dogsdogsdogs/src/calculus.rs @@ -34,7 +34,7 @@ impl Differentiate for Collection where G: Scope, D: Data, - R: Abelian, + R: Abelian + 'static, { // For each (data, Alt(time), diff) we add a (data, Neu(time), -diff). fn differentiate<'a>(&self, child: &Child<'a, G, AltNeu>) -> Collection>, D, R> { @@ -53,7 +53,7 @@ impl<'a, G, D, R> Integrate for Collection Collection { diff --git a/dogsdogsdogs/src/lib.rs b/dogsdogsdogs/src/lib.rs index 262e09609..3e7399469 100644 --- a/dogsdogsdogs/src/lib.rs +++ b/dogsdogsdogs/src/lib.rs @@ -44,7 +44,7 @@ impl ProposeExtensionMethod for Collection where G: Scope, P: ExchangeData+Ord, - R: Monoid+Multiply, + R: Monoid+Multiply+'static, { fn propose_using(&self, extender: &mut PE) -> Collection where diff --git a/dogsdogsdogs/src/operators/half_join.rs b/dogsdogsdogs/src/operators/half_join.rs index 799febeef..846107727 100644 --- a/dogsdogsdogs/src/operators/half_join.rs +++ b/dogsdogsdogs/src/operators/half_join.rs @@ -140,7 +140,7 @@ where FF: Fn(&G::Timestamp, &mut Antichain) + 'static, CF: Fn(&G::Timestamp, &G::Timestamp) -> bool + 'static, DOut: Clone+'static, - ROut: Semigroup, + ROut: Semigroup + 'static, Y: Fn(std::time::Instant, usize) -> bool + 'static, I: IntoIterator, S: FnMut(&K, &V, Tr::Val<'_>, &G::Timestamp, &G::Timestamp, &R, &Tr::Diff)-> I + 'static, diff --git a/dogsdogsdogs/src/operators/lookup_map.rs b/dogsdogsdogs/src/operators/lookup_map.rs index c361871ac..ede8b1f3c 100644 --- a/dogsdogsdogs/src/operators/lookup_map.rs +++ b/dogsdogsdogs/src/operators/lookup_map.rs @@ -36,7 +36,7 @@ where D: ExchangeData, R: ExchangeData+Monoid, DOut: Clone+'static, - ROut: Monoid, + ROut: Monoid + 'static, S: FnMut(&D, &R, Tr::Val<'_>, &Tr::Diff)->(DOut, ROut)+'static, { // No need to block physical merging for this operator. diff --git a/src/collection.rs b/src/collection.rs index 2e82c7e62..ce2dd54a9 100644 --- a/src/collection.rs +++ b/src/collection.rs @@ -45,7 +45,7 @@ pub struct Collection { pub inner: Stream } -impl Collection where G::Timestamp: Data { +impl Collection where G::Timestamp: Data { /// Creates a new Collection from a timely dataflow stream. /// /// This method seems to be rarely used, with the `as_collection` method on streams being a more @@ -226,7 +226,7 @@ impl Collection where G::Timestamp: Da pub fn explode(&self, mut logic: L) -> Collection>::Output> where D2: Data, R2: Semigroup+Multiply, - >::Output: Data+Semigroup, + >::Output: Semigroup+'static, I: IntoIterator, L: FnMut(D)->I+'static, { @@ -261,7 +261,7 @@ impl Collection where G::Timestamp: Da where G::Timestamp: Lattice, D2: Data, R2: Semigroup+Multiply, - >::Output: Data+Semigroup, + >::Output: Semigroup+'static, I: IntoIterator, L: FnMut(D)->I+'static, { @@ -476,7 +476,7 @@ use timely::dataflow::scopes::ScopeParent; use timely::progress::timestamp::Refines; /// Methods requiring a nested scope. -impl<'a, G: Scope, T: Timestamp, D: Data, R: Semigroup> Collection, D, R> +impl<'a, G: Scope, T: Timestamp, D: Data, R: Semigroup+'static> Collection, D, R> where T: Refines<::Timestamp>, { @@ -509,7 +509,7 @@ where } /// Methods requiring a region as the scope. -impl<'a, G: Scope, D: Data, R: Semigroup> Collection, D, R> +impl<'a, G: Scope, D: Data, R: Semigroup+'static> Collection, D, R> { /// Returns the value of a Collection from a nested region to its containing scope. /// @@ -523,7 +523,7 @@ impl<'a, G: Scope, D: Data, R: Semigroup> Collection, } /// Methods requiring an Abelian difference, to support negation. -impl Collection where G::Timestamp: Data { +impl Collection where G::Timestamp: Data { /// Creates a new collection whose counts are the negation of those in the input. /// /// This method is most commonly used with `concat` to get those element in one collection but not another. @@ -594,7 +594,7 @@ pub trait AsCollection { fn as_collection(&self) -> Collection; } -impl AsCollection for Stream { +impl AsCollection for Stream { fn as_collection(&self) -> Collection { Collection::new(self.clone()) } @@ -625,7 +625,7 @@ pub fn concatenate(scope: &mut G, iterator: I) -> Collection>, { scope diff --git a/src/consolidation.rs b/src/consolidation.rs index 497d15b9a..1409da072 100644 --- a/src/consolidation.rs +++ b/src/consolidation.rs @@ -145,7 +145,7 @@ impl ConsolidatingContainerBuilder> where D: Data, T: Data, - R: Semigroup, + R: Semigroup+'static, { /// Flush `self.current` up to the biggest `multiple` of elements. Pass 1 to flush all elements. // TODO: Can we replace `multiple` by a bool? @@ -165,7 +165,7 @@ impl ContainerBuilder for ConsolidatingContainerBuilder> where D: Data, T: Data, - R: Semigroup, + R: Semigroup+'static, { type Container = Vec<(D,T,R)>; diff --git a/src/difference.rs b/src/difference.rs index 46c7ba3eb..0a63e1682 100644 --- a/src/difference.rs +++ b/src/difference.rs @@ -6,8 +6,6 @@ //! dataflow collections would then track for each record the total of counts and heights, which allows //! us to track something like the average. -use crate::Data; - #[deprecated] pub use self::Abelian as Diff; @@ -22,7 +20,7 @@ pub use self::Abelian as Diff; /// There is a light presumption of commutativity here, in that while we will largely perform addition /// in order of timestamps, for many types of timestamps there is no total order and consequently no /// obvious order to respect. Non-commutative semigroups should be used with care. -pub trait Semigroup : Data + Clone { +pub trait Semigroup : Clone { /// The method of `std::ops::AddAssign`, for types that do not implement `AddAssign`. fn plus_equals(&mut self, rhs: &Rhs); /// Returns true if the element is the additive identity. diff --git a/src/dynamic/mod.rs b/src/dynamic/mod.rs index 18208d3ae..d13eadcd8 100644 --- a/src/dynamic/mod.rs +++ b/src/dynamic/mod.rs @@ -30,7 +30,7 @@ impl Collection where G: Scope>>, D: Data, - R: Semigroup, + R: Semigroup+'static, T: Timestamp+Default, TOuter: Timestamp, { diff --git a/src/input.rs b/src/input.rs index 889275563..5a73b14a9 100644 --- a/src/input.rs +++ b/src/input.rs @@ -42,7 +42,7 @@ pub trait Input : TimelyInput { /// }).unwrap(); /// ``` fn new_collection(&mut self) -> (InputSession<::Timestamp, D, R>, Collection) - where D: Data, R: Semigroup; + where D: Data, R: Semigroup+'static; /// Create a new collection and input handle from initial data. /// /// # Examples @@ -94,13 +94,13 @@ pub trait Input : TimelyInput { /// }).unwrap(); /// ``` fn new_collection_from_raw(&mut self, data: I) -> (InputSession<::Timestamp, D, R>, Collection) - where I: IntoIterator::Timestamp,R)>+'static, D: Data, R: Semigroup+Data; + where I: IntoIterator::Timestamp,R)>+'static, D: Data, R: Semigroup+'static; } use crate::lattice::Lattice; impl Input for G where ::Timestamp: Lattice { fn new_collection(&mut self) -> (InputSession<::Timestamp, D, R>, Collection) - where D: Data, R: Semigroup{ + where D: Data, R: Semigroup+'static{ let (handle, stream) = self.new_input(); (InputSession::from(handle), stream.as_collection()) } @@ -111,7 +111,7 @@ impl Input for G where ::Timestamp: Lattice { fn new_collection_from_raw(&mut self, data: I) -> (InputSession<::Timestamp, D, R>, Collection) where D: Data, - R: Semigroup+Data, + R: Semigroup+'static, I: IntoIterator::Timestamp,R)>+'static, { use timely::dataflow::operators::ToStream; @@ -166,7 +166,7 @@ impl Input for G where ::Timestamp: Lattice { /// /// }).unwrap(); /// ``` -pub struct InputSession { +pub struct InputSession { time: T, buffer: Vec<(D, T, R)>, handle: Handle, @@ -193,7 +193,7 @@ impl InputSession { // pub fn remove(&mut self, element: D) { self.update(element,-1); } // } -impl InputSession { +impl InputSession { /// Introduces a handle as collection. pub fn to_collection(&mut self, scope: &mut G) -> Collection @@ -281,7 +281,7 @@ impl InputSession { pub fn close(self) { } } -impl Drop for InputSession { +impl Drop for InputSession { fn drop(&mut self) { self.flush(); } diff --git a/src/operators/arrange/arrangement.rs b/src/operators/arrange/arrangement.rs index 83231d58c..f0454905d 100644 --- a/src/operators/arrange/arrangement.rs +++ b/src/operators/arrange/arrangement.rs @@ -244,7 +244,7 @@ where where T2: for<'a> TraceReader=T1::Key<'a>,Time=T1::Time>+Clone+'static, T1::Diff: Multiply, - >::Output: Semigroup, + >::Output: Semigroup+'static, I: IntoIterator, I::Item: Data, L: FnMut(T1::Key<'_>,T1::Val<'_>,T2::Val<'_>)->I+'static @@ -261,7 +261,7 @@ where where T2: for<'a> TraceReader=T1::Key<'a>, Time=T1::Time>+Clone+'static, D: Data, - ROut: Semigroup, + ROut: Semigroup+'static, I: IntoIterator, L: FnMut(T1::Key<'_>, T1::Val<'_>,T2::Val<'_>,&G::Timestamp,&T1::Diff,&T2::Diff)->I+'static, { @@ -603,7 +603,7 @@ where /// This arrangement requires `Key: Hashable`, and uses the `hashed()` method to place keys in a hashed /// map. This can result in many hash calls, and in some cases it may help to first transform `K` to the /// pair `(u64, K)` of hash value and key. -pub trait ArrangeByKey +pub trait ArrangeByKey where G::Timestamp: Lattice+Ord { /// Arranges a collection of `(Key, Val)` records by `Key`. /// @@ -634,7 +634,7 @@ where /// This arrangement requires `Key: Hashable`, and uses the `hashed()` method to place keys in a hashed /// map. This can result in many hash calls, and in some cases it may help to first transform `K` to the /// pair `(u64, K)` of hash value and key. -pub trait ArrangeBySelf +pub trait ArrangeBySelf where G::Timestamp: Lattice+Ord { diff --git a/src/operators/count.rs b/src/operators/count.rs index 6c0400179..89659e4ce 100644 --- a/src/operators/count.rs +++ b/src/operators/count.rs @@ -41,12 +41,12 @@ pub trait CountTotal where G::Timestamp /// This method allows `count_total` to produce collections whose difference /// type is something other than an `isize` integer, for example perhaps an /// `i32`. - fn count_total_core>(&self) -> Collection; + fn count_total_core + 'static>(&self) -> Collection; } impl CountTotal for Collection where G::Timestamp: TotalOrder+Lattice+Ord { - fn count_total_core>(&self) -> Collection { + fn count_total_core + 'static>(&self) -> Collection { self.arrange_by_self_named("Arrange: CountTotal") .count_total_core() } @@ -61,7 +61,7 @@ where T1::Time: TotalOrder, T1::Diff: ExchangeData, { - fn count_total_core>(&self) -> Collection { + fn count_total_core + 'static>(&self) -> Collection { let mut trace = self.trace.clone(); let mut buffer = Vec::new(); diff --git a/src/operators/iterate.rs b/src/operators/iterate.rs index 6d0e27144..32c6d1cda 100644 --- a/src/operators/iterate.rs +++ b/src/operators/iterate.rs @@ -76,7 +76,7 @@ pub trait Iterate { for<'a> F: FnOnce(&Collection, D, R>)->Collection, D, R>; } -impl Iterate for Collection { +impl Iterate for Collection { fn iterate(&self, logic: F) -> Collection where G::Timestamp: Lattice, for<'a> F: FnOnce(&Collection, D, R>)->Collection, D, R> { @@ -96,7 +96,7 @@ impl Iterate for Collection Iterate for G { +impl Iterate for G { fn iterate(&self, logic: F) -> Collection where G::Timestamp: Lattice, for<'a> F: FnOnce(&Collection, D, R>)->Collection, D, R> { @@ -151,7 +151,7 @@ impl Iterate for G { /// }); /// }) /// ``` -pub struct Variable +pub struct Variable where G::Timestamp: Lattice { collection: Collection, feedback: Handle>, @@ -222,7 +222,7 @@ impl Deref for Variable where G::Timesta /// that do not implement `Abelian` and only implement `Semigroup`. This means /// that it can be used in settings where the difference type does not support /// negation. -pub struct SemigroupVariable +pub struct SemigroupVariable where G::Timestamp: Lattice { collection: Collection, feedback: Handle>, diff --git a/src/operators/join.rs b/src/operators/join.rs index d5132d606..7db301fca 100644 --- a/src/operators/join.rs +++ b/src/operators/join.rs @@ -56,7 +56,7 @@ pub trait Join { V2: ExchangeData, R2: ExchangeData+Semigroup, R: Multiply, - >::Output: Semigroup + >::Output: Semigroup+'static { self.join_map(other, |k,v,v2| (k.clone(),(v.clone(),v2.clone()))) } @@ -80,7 +80,7 @@ pub trait Join { /// }); /// ``` fn join_map(&self, other: &Collection, logic: L) -> Collection>::Output> - where K: ExchangeData, V2: ExchangeData, R2: ExchangeData+Semigroup, R: Multiply, >::Output: Semigroup, D: Data, L: FnMut(&K, &V, &V2)->D+'static; + where K: ExchangeData, V2: ExchangeData, R2: ExchangeData+Semigroup, R: Multiply, >::Output: Semigroup+'static, D: Data, L: FnMut(&K, &V, &V2)->D+'static; /// Matches pairs `(key, val)` and `key` based on `key`, producing the former with frequencies multiplied. /// @@ -105,7 +105,7 @@ pub trait Join { /// }); /// ``` fn semijoin(&self, other: &Collection) -> Collection>::Output> - where K: ExchangeData, R2: ExchangeData+Semigroup, R: Multiply, >::Output: Semigroup; + where K: ExchangeData, R2: ExchangeData+Semigroup, R: Multiply, >::Output: Semigroup+'static; /// Subtracts the semijoin with `other` from `self`. /// @@ -134,7 +134,7 @@ pub trait Join { /// }); /// ``` fn antijoin(&self, other: &Collection) -> Collection - where K: ExchangeData, R2: ExchangeData+Semigroup, R: Multiply, R: Abelian; + where K: ExchangeData, R2: ExchangeData+Semigroup, R: Multiply, R: Abelian+'static; } impl Join for Collection @@ -146,21 +146,21 @@ where G::Timestamp: Lattice+Ord, { fn join_map(&self, other: &Collection, mut logic: L) -> Collection>::Output> - where R: Multiply, >::Output: Semigroup, L: FnMut(&K, &V, &V2)->D+'static { + where R: Multiply, >::Output: Semigroup+'static, L: FnMut(&K, &V, &V2)->D+'static { let arranged1 = self.arrange_by_key(); let arranged2 = other.arrange_by_key(); arranged1.join_core(&arranged2, move |k,v1,v2| Some(logic(k,v1,v2))) } fn semijoin(&self, other: &Collection) -> Collection>::Output> - where R: Multiply, >::Output: Semigroup { + where R: Multiply, >::Output: Semigroup+'static { let arranged1 = self.arrange_by_key(); let arranged2 = other.arrange_by_self(); arranged1.join_core(&arranged2, |k,v,_| Some((k.clone(), v.clone()))) } fn antijoin(&self, other: &Collection) -> Collection - where R: Multiply, R: Abelian { + where R: Multiply, R: Abelian+'static { self.concat(&self.semijoin(other).negate()) } } @@ -175,7 +175,7 @@ where fn join_map(&self, other: &Collection, mut logic: L) -> Collection>::Output> where Tr::Diff: Multiply, - >::Output: Semigroup, + >::Output: Semigroup+'static, L: for<'a> FnMut(Tr::Key<'a>, Tr::Val<'a>, &V2)->D+'static, { let arranged2 = other.arrange_by_key(); @@ -183,13 +183,13 @@ where } fn semijoin(&self, other: &Collection) -> Collection>::Output> - where Tr::Diff: Multiply, >::Output: Semigroup { + where Tr::Diff: Multiply, >::Output: Semigroup+'static { let arranged2 = other.arrange_by_self(); self.join_core(&arranged2, |k,v,_| Some((k.clone(), v.clone()))) } fn antijoin(&self, other: &Collection) -> Collection - where Tr::Diff: Multiply, Tr::Diff: Abelian { + where Tr::Diff: Multiply, Tr::Diff: Abelian+'static { self.as_collection(|k,v| (k.clone(), v.clone())) .concat(&self.semijoin(other).negate()) } @@ -236,7 +236,7 @@ pub trait JoinCore TraceReader=&'a K, Time=G::Timestamp>+Clone+'static, R: Multiply, - >::Output: Semigroup, + >::Output: Semigroup+'static, I: IntoIterator, I::Item: Data, L: FnMut(&K,&V,Tr2::Val<'_>)->I+'static, @@ -279,7 +279,7 @@ pub trait JoinCore TraceReader=&'a K, Time=G::Timestamp>+Clone+'static, D: Data, - ROut: Semigroup, + ROut: Semigroup+'static, I: IntoIterator, L: for<'a> FnMut(&K,&V,Tr2::Val<'_>,&G::Timestamp,&R,&Tr2::Diff)->I+'static, ; @@ -298,7 +298,7 @@ where where Tr2: for<'a> TraceReader=&'a K, Time=G::Timestamp>+Clone+'static, R: Multiply, - >::Output: Semigroup, + >::Output: Semigroup+'static, I: IntoIterator, I::Item: Data, L: FnMut(&K,&V,Tr2::Val<'_>)->I+'static, @@ -313,7 +313,7 @@ where I: IntoIterator, L: FnMut(&K,&V,Tr2::Val<'_>,&G::Timestamp,&R,&Tr2::Diff)->I+'static, D: Data, - ROut: Semigroup, + ROut: Semigroup+'static, { self.arrange_by_key().join_core_internal_unsafe(stream2, result) } diff --git a/src/operators/reduce.rs b/src/operators/reduce.rs index 34e8fef96..0bd99995d 100644 --- a/src/operators/reduce.rs +++ b/src/operators/reduce.rs @@ -59,13 +59,13 @@ pub trait Reduce where G::Timestamp: L /// }); /// }); /// ``` - fn reduce(&self, logic: L) -> Collection + fn reduce(&self, logic: L) -> Collection where L: FnMut(&K, &[(&V, R)], &mut Vec<(V2, R2)>)+'static { self.reduce_named("Reduce", logic) } /// As `reduce` with the ability to name the operator. - fn reduce_named(&self, name: &str, logic: L) -> Collection + fn reduce_named(&self, name: &str, logic: L) -> Collection where L: FnMut(&K, &[(&V, R)], &mut Vec<(V2, R2)>)+'static; } @@ -77,21 +77,21 @@ impl Reduce for Collection V: ExchangeData, R: ExchangeData+Semigroup, { - fn reduce_named(&self, name: &str, logic: L) -> Collection + fn reduce_named(&self, name: &str, logic: L) -> Collection where L: FnMut(&K, &[(&V, R)], &mut Vec<(V2, R2)>)+'static { self.arrange_by_key_named(&format!("Arrange: {}", name)) .reduce_named(name, logic) } } -impl Reduce for Arranged +impl Reduce for Arranged where G: Scope, T1: for<'a> TraceReader=&'a K, Val<'a>=&'a V, Diff=R>+Clone+'static, for<'a> T1::Key<'a> : IntoOwned<'a, Owned = K>, for<'a> T1::Val<'a> : IntoOwned<'a, Owned = V>, { - fn reduce_named(&self, name: &str, logic: L) -> Collection + fn reduce_named(&self, name: &str, logic: L) -> Collection where L: FnMut(&K, &[(&V, R)], &mut Vec<(V2, R2)>)+'static { self.reduce_abelian::<_,K,V2,ValSpine<_,_,_,_>>(name, logic) .as_collection(|k,v| (k.clone(), v.clone())) @@ -119,12 +119,12 @@ pub trait Threshold where G::Timestamp: Lattic /// .threshold(|_,c| c % 2); /// }); /// ``` - fn thresholdR2+'static>(&self, thresh: F) -> Collection { + fn thresholdR2+'static>(&self, thresh: F) -> Collection { self.threshold_named("Threshold", thresh) } /// A `threshold` with the ability to name the operator. - fn threshold_namedR2+'static>(&self, name: &str, thresh: F) -> Collection; + fn threshold_namedR2+'static>(&self, name: &str, thresh: F) -> Collection; /// Reduces the collection to one occurrence of each distinct element. /// @@ -150,14 +150,14 @@ pub trait Threshold where G::Timestamp: Lattic /// This method allows `distinct` to produce collections whose difference /// type is something other than an `isize` integer, for example perhaps an /// `i32`. - fn distinct_core>(&self) -> Collection { + fn distinct_core>(&self) -> Collection { self.threshold_named("Distinct", |_,_| R2::from(1i8)) } } impl Threshold for Collection where G::Timestamp: Lattice+Ord { - fn threshold_namedR2+'static>(&self, name: &str, thresh: F) -> Collection { + fn threshold_namedR2+'static>(&self, name: &str, thresh: F) -> Collection { self.arrange_by_self_named(&format!("Arrange: {}", name)) .threshold_named(name, thresh) } @@ -169,7 +169,7 @@ where T1: for<'a> TraceReader=&'a K, Val<'a>=&'a (), Diff=R1>+Clone+'static, for<'a> T1::Key<'a>: IntoOwned<'a, Owned = K>, { - fn threshold_namedR2+'static>(&self, name: &str, mut thresh: F) -> Collection { + fn threshold_namedR2+'static>(&self, name: &str, mut thresh: F) -> Collection { self.reduce_abelian::<_,K,(),KeySpine<_,_,_>>(name, move |k,s,t| t.push(((), thresh(k, &s[0].1)))) .as_collection(|k,_| k.clone()) } @@ -201,26 +201,26 @@ pub trait Count where G::Timestamp: Lattice+Ord /// This method allows `count` to produce collections whose difference /// type is something other than an `isize` integer, for example perhaps an /// `i32`. - fn count_core>(&self) -> Collection; + fn count_core + 'static>(&self) -> Collection; } impl Count for Collection where G::Timestamp: Lattice+Ord, { - fn count_core>(&self) -> Collection { + fn count_core + 'static>(&self) -> Collection { self.arrange_by_self_named("Arrange: Count") .count_core() } } -impl Count for Arranged +impl Count for Arranged where G: Scope, T1: for<'a> TraceReader=&'a K, Val<'a>=&'a (), Diff=R>+Clone+'static, for<'a> T1::Key<'a>: IntoOwned<'a, Owned = K>, { - fn count_core>(&self) -> Collection { + fn count_core + 'static>(&self) -> Collection { self.reduce_abelian::<_,K,R,ValSpine<_,R,_,_>>("Count", |_k,s,t| t.push((s[0].1.clone(), R2::from(1i8)))) .as_collection(|k,c| (k.clone(), c.clone())) } diff --git a/src/operators/threshold.rs b/src/operators/threshold.rs index 1358d8e3b..e05854694 100644 --- a/src/operators/threshold.rs +++ b/src/operators/threshold.rs @@ -21,7 +21,7 @@ pub trait ThresholdTotal w /// Reduces the collection to one occurrence of each distinct element. fn threshold_semigroup(&self, thresh: F) -> Collection where - R2: Semigroup, + R2: Semigroup+'static, F: FnMut(&K,&R,Option<&R>)->Option+'static, ; /// Reduces the collection to one occurrence of each distinct element. @@ -39,7 +39,7 @@ pub trait ThresholdTotal w /// .threshold_total(|_,c| c % 2); /// }); /// ``` - fn threshold_totalR2+'static>(&self, mut thresh: F) -> Collection { + fn threshold_totalR2+'static>(&self, mut thresh: F) -> Collection { self.threshold_semigroup(move |key, new, old| { let mut new = thresh(key, new); if let Some(old) = old { new.plus_equals(&thresh(key, old).negate()); } @@ -74,7 +74,7 @@ pub trait ThresholdTotal w /// This method allows `distinct` to produce collections whose difference /// type is something other than an `isize` integer, for example perhaps an /// `i32`. - fn distinct_total_core>(&self) -> Collection { + fn distinct_total_core+'static>(&self) -> Collection { self.threshold_total(|_,_| R2::from(1i8)) } @@ -84,7 +84,7 @@ impl ThresholdTot where G::Timestamp: TotalOrder+Lattice+Ord { fn threshold_semigroup(&self, thresh: F) -> Collection where - R2: Semigroup, + R2: Semigroup+'static, F: FnMut(&K,&R,Option<&R>)->Option+'static, { self.arrange_by_self_named("Arrange: ThresholdTotal") @@ -102,7 +102,7 @@ where { fn threshold_semigroup(&self, mut thresh: F) -> Collection where - R2: Semigroup, + R2: Semigroup+'static, F: for<'a> FnMut(T1::Key<'a>,&T1::Diff,Option<&T1::Diff>)->Option+'static, { diff --git a/src/trace/implementations/mod.rs b/src/trace/implementations/mod.rs index 6a0fe72c9..d9fd29932 100644 --- a/src/trace/implementations/mod.rs +++ b/src/trace/implementations/mod.rs @@ -66,17 +66,17 @@ pub trait Update { /// Values associated with the key. type Val: Ord + Clone + 'static; /// Time at which updates occur. - type Time: Ord+Lattice+timely::progress::Timestamp+Clone; + type Time: Ord + Clone + Lattice + timely::progress::Timestamp; /// Way in which updates occur. - type Diff: Semigroup+Clone; + type Diff: Ord + Semigroup + 'static; } impl Update for ((K, V), T, R) where K: Ord+Clone+'static, V: Ord+Clone+'static, - T: Ord+Lattice+timely::progress::Timestamp+Clone, - R: Semigroup+Clone, + T: Ord+Clone+Lattice+timely::progress::Timestamp, + R: Ord+Semigroup+'static, { type Key = K; type Val = V; @@ -108,8 +108,7 @@ pub struct Vector { impl Layout for Vector where - U::Key: 'static, - U::Val: 'static, + U::Diff: Ord, { type Target = U; type KeyContainer = Vec; @@ -125,10 +124,10 @@ pub struct TStack { impl Layout for TStack where - U::Key: Columnation + 'static, - U::Val: Columnation + 'static, + U::Key: Columnation, + U::Val: Columnation, U::Time: Columnation, - U::Diff: Columnation, + U::Diff: Columnation + Ord, { type Target = U; type KeyContainer = TimelyStack; @@ -164,8 +163,8 @@ where K::Owned: Ord+Clone+'static, V: ToOwned + ?Sized, V::Owned: Ord+Clone+'static, - T: Ord+Lattice+timely::progress::Timestamp+Clone, - R: Semigroup+Clone, + T: Ord+Clone+Lattice+timely::progress::Timestamp, + R: Ord+Clone+Semigroup+'static, { type Key = K::Owned; type Val = V::Owned; @@ -177,11 +176,10 @@ impl Layout for Preferred where K: Ord+ToOwned+PreferredContainer + ?Sized, K::Owned: Ord+Clone+'static, - // for<'a> K::Container: BatchContainer = &'a K>, V: Ord+ToOwned+PreferredContainer + ?Sized, V::Owned: Ord+Clone+'static, - T: Ord+Lattice+timely::progress::Timestamp+Clone, - D: Semigroup+Clone, + T: Ord+Clone+Lattice+timely::progress::Timestamp, + D: Ord+Clone+Semigroup+'static, { type Target = Preferred; type KeyContainer = K::Container; @@ -361,7 +359,7 @@ where K: Ord + Clone + 'static, V: Ord + Clone + 'static, T: Timestamp + Lattice + Clone + 'static, - R: Semigroup + Clone + 'static, + R: Ord + Semigroup + 'static, { type Key<'a> = K; type Val<'a> = V; @@ -386,7 +384,7 @@ where K: Ord + Columnation + Clone + 'static, V: Ord + Columnation + Clone + 'static, T: Timestamp + Lattice + Columnation + Clone + 'static, - R: Semigroup + Columnation + Clone + 'static, + R: Ord + Clone + Semigroup + Columnation + 'static, { type Key<'a> = &'a K; type Val<'a> = &'a V; @@ -414,8 +412,8 @@ where V: Ord+ToOwned+PreferredContainer + ?Sized, V::Owned: Columnation + Ord+Clone+'static, for<'a> <::Container as BatchContainer>::ReadItem<'a> : IntoOwned<'a, Owned = V::Owned>, - T: Columnation + Ord+Lattice+Timestamp+Clone, - R: Columnation + Semigroup+Clone, + T: Columnation + Ord+Clone+Lattice+Timestamp, + R: Columnation + Ord+Clone+Semigroup+'static, { type Key<'a> = &'a K::Owned; type Val<'a> = &'a V::Owned; diff --git a/src/trace/mod.rs b/src/trace/mod.rs index 8980c7397..1f513333f 100644 --- a/src/trace/mod.rs +++ b/src/trace/mod.rs @@ -58,7 +58,7 @@ pub trait TraceReader { /// Timestamps associated with updates type Time: Timestamp + Lattice + Ord + Clone; /// Associated update. - type Diff: Semigroup; + type Diff: Semigroup + 'static; /// The type of an immutable collection of updates. type Batch: for<'a> BatchReader = Self::Key<'a>, Val<'a> = Self::Val<'a>, Time = Self::Time, Diff = Self::Diff>+Clone+'static;