@@ -93,10 +93,10 @@ pub trait Layout {
93
93
type KeyContainer : BatchContainer + PushInto < <Self :: Target as Update >:: Key > ;
94
94
/// Container for update vals.
95
95
type ValContainer : BatchContainer ;
96
- /// Container for update vals .
97
- type UpdContainer :
98
- PushInto < ( < Self :: Target as Update > :: Time , < Self :: Target as Update > :: Diff ) > +
99
- for < ' a > BatchContainer < ReadItem < ' a > = & ' a ( <Self :: Target as Update >:: Time , < Self :: Target as Update >:: Diff ) > ;
96
+ /// Container for times .
97
+ type TimeContainer : BatchContainer < Owned = < Self :: Target as Update > :: Time > + PushInto < < Self :: Target as Update > :: Time > ;
98
+ /// Container for diffs.
99
+ type DiffContainer : BatchContainer < Owned = <Self :: Target as Update >:: Diff > + PushInto < < Self :: Target as Update >:: Diff > ;
100
100
/// Container for offsets.
101
101
type OffsetContainer : for < ' a > BatchContainer < ReadItem < ' a > = usize > ;
102
102
}
@@ -113,7 +113,8 @@ where
113
113
type Target = U ;
114
114
type KeyContainer = Vec < U :: Key > ;
115
115
type ValContainer = Vec < U :: Val > ;
116
- type UpdContainer = Vec < ( U :: Time , U :: Diff ) > ;
116
+ type TimeContainer = Vec < U :: Time > ;
117
+ type DiffContainer = Vec < U :: Diff > ;
117
118
type OffsetContainer = OffsetList ;
118
119
}
119
120
@@ -132,7 +133,8 @@ where
132
133
type Target = U ;
133
134
type KeyContainer = TimelyStack < U :: Key > ;
134
135
type ValContainer = TimelyStack < U :: Val > ;
135
- type UpdContainer = TimelyStack < ( U :: Time , U :: Diff ) > ;
136
+ type TimeContainer = TimelyStack < U :: Time > ;
137
+ type DiffContainer = TimelyStack < U :: Diff > ;
136
138
type OffsetContainer = OffsetList ;
137
139
}
138
140
@@ -184,7 +186,8 @@ where
184
186
type Target = Preferred < K , V , T , D > ;
185
187
type KeyContainer = K :: Container ;
186
188
type ValContainer = V :: Container ;
187
- type UpdContainer = Vec < ( T , D ) > ;
189
+ type TimeContainer = Vec < T > ;
190
+ type DiffContainer = Vec < D > ;
188
191
type OffsetContainer = OffsetList ;
189
192
}
190
193
@@ -304,6 +307,7 @@ impl<'a> IntoOwned<'a> for usize {
304
307
}
305
308
306
309
impl BatchContainer for OffsetList {
310
+ type Owned = usize ;
307
311
type ReadItem < ' a > = usize ;
308
312
309
313
fn copy ( & mut self , item : Self :: ReadItem < ' _ > ) {
@@ -442,11 +446,15 @@ pub mod containers {
442
446
443
447
use timely:: container:: columnation:: { Columnation , TimelyStack } ;
444
448
use timely:: container:: PushInto ;
449
+ use crate :: trace:: IntoOwned ;
445
450
446
451
/// A general-purpose container resembling `Vec<T>`.
447
452
pub trait BatchContainer : ' static {
453
+ /// An owned instance of `Self::ReadItem<'_>`.
454
+ type Owned ;
455
+
448
456
/// The type that can be read back out of the container.
449
- type ReadItem < ' a > : Copy + Ord ;
457
+ type ReadItem < ' a > : Copy + Ord + IntoOwned < ' a , Owned = Self :: Owned > ;
450
458
451
459
/// Push an item into this container
452
460
fn push < D > ( & mut self , item : D ) where Self : PushInto < D > {
@@ -532,6 +540,7 @@ pub mod containers {
532
540
// All `T: Clone` also implement `ToOwned<Owned = T>`, but without the constraint Rust
533
541
// struggles to understand why the owned type must be `T` (i.e. the one blanket impl).
534
542
impl < T : Ord + Clone + ' static > BatchContainer for Vec < T > {
543
+ type Owned = T ;
535
544
type ReadItem < ' a > = & ' a T ;
536
545
537
546
fn reborrow < ' b , ' a : ' b > ( item : Self :: ReadItem < ' a > ) -> Self :: ReadItem < ' b > { item }
@@ -558,7 +567,8 @@ pub mod containers {
558
567
559
568
// The `ToOwned` requirement exists to satisfy `self.reserve_items`, who must for now
560
569
// be presented with the actual contained type, rather than a type that borrows into it.
561
- impl < T : Ord + Columnation + ' static > BatchContainer for TimelyStack < T > {
570
+ impl < T : Clone + Ord + Columnation + ' static > BatchContainer for TimelyStack < T > {
571
+ type Owned = T ;
562
572
type ReadItem < ' a > = & ' a T ;
563
573
564
574
fn reborrow < ' b , ' a : ' b > ( item : Self :: ReadItem < ' a > ) -> Self :: ReadItem < ' b > { item }
@@ -625,6 +635,7 @@ pub mod containers {
625
635
where
626
636
B : Ord + Clone + Sized + ' static ,
627
637
{
638
+ type Owned = Vec < B > ;
628
639
type ReadItem < ' a > = & ' a [ B ] ;
629
640
630
641
fn reborrow < ' b , ' a : ' b > ( item : Self :: ReadItem < ' a > ) -> Self :: ReadItem < ' b > { item }
0 commit comments