Skip to content

Commit

Permalink
fix: do not take ownership of indexed values to convert to Vec<u8>
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrezot committed Nov 7, 2023
1 parent 0ee86b8 commit f22183e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/findex_graph/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<
);
let indexed_values = indexed_values
.into_iter()
.map(|(token, value)| (token, value.into_iter().map(Into::into).collect()))
.map(|(token, value)| (token, value.iter().map(Into::into).collect()))
.collect();
self.findex_mm
.complete_compacting(rng, key, indexed_values, continuation, label)
Expand Down
2 changes: 1 addition & 1 deletion src/findex_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl<
.map(|(tag, modifications)| {
let modifications = modifications
.into_iter()
.map(|(op, value)| (op, value.into()))
.map(|(op, value)| (op, (&value).into()))
.collect();
(tag, modifications)
})
Expand Down
4 changes: 2 additions & 2 deletions src/findex_graph/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ impl<Tag, Value> IndexedValue<Tag, Value> {
}
}

impl<Tag: AsRef<[u8]>, Value: AsRef<[u8]>> From<IndexedValue<Tag, Value>> for Vec<u8> {
fn from(value: IndexedValue<Tag, Value>) -> Self {
impl<Tag: AsRef<[u8]>, Value: AsRef<[u8]>> From<&IndexedValue<Tag, Value>> for Vec<u8> {
fn from(value: &IndexedValue<Tag, Value>) -> Self {
match value {
IndexedValue::Pointer(pointer) => {
let pointer = pointer.as_ref();
Expand Down

0 comments on commit f22183e

Please sign in to comment.