Skip to content

Commit

Permalink
Update flatcontainer to 0.4.0
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Hoffmann <[email protected]>
  • Loading branch information
antiguru committed May 28, 2024
1 parent 7042fa8 commit c568ff8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion container/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ license = "MIT"

[dependencies]
columnation = { git = "https://github.com/frankmcsherry/columnation" }
flatcontainer = "0.3"
flatcontainer = "0.4"
serde = { version = "1.0"}
15 changes: 10 additions & 5 deletions container/src/columnation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ mod flatcontainer {
}
}

impl<T: Columnation> Region for ColumnationRegion<T> {
impl<T: Columnation + Clone> Region for ColumnationRegion<T> {
type Owned = T;
type ReadItem<'a> = &'a T where Self: 'a;
type Index = usize;

Expand All @@ -426,30 +427,34 @@ mod flatcontainer {
fn heap_size<F: FnMut(usize, usize)>(&self, callback: F) {
self.inner.heap_size(callback);
}

fn reborrow<'b, 'a: 'b>(item: Self::ReadItem<'a>) -> Self::ReadItem<'b> where Self: 'a {
item
}
}

impl<T: Columnation> Push<T> for ColumnationRegion<T> {
impl<T: Columnation + Clone> Push<T> for ColumnationRegion<T> {
fn push(&mut self, item: T) -> Self::Index {
self.inner.copy(&item);
self.inner.len() - 1
}
}

impl<T: Columnation> Push<&T> for ColumnationRegion<T> {
impl<T: Columnation + Clone> Push<&T> for ColumnationRegion<T> {
fn push(&mut self, item: &T) -> Self::Index {
self.inner.copy(item);
self.inner.len() - 1
}
}

impl<T: Columnation> Push<&&T> for ColumnationRegion<T> {
impl<T: Columnation + Clone> Push<&&T> for ColumnationRegion<T> {
fn push(&mut self, item: &&T) -> Self::Index {
self.inner.copy(*item);
self.inner.len() - 1
}
}

impl<'a, T: Columnation + 'a> ReserveItems<&'a T> for ColumnationRegion<T> {
impl<'a, T: Columnation + Clone + 'a> ReserveItems<&'a T> for ColumnationRegion<T> {
fn reserve_items<I>(&mut self, items: I) where I: Iterator<Item=&'a T> + Clone {
self.inner.reserve_items(items);
}
Expand Down

0 comments on commit c568ff8

Please sign in to comment.