Skip to content

Commit

Permalink
Alter signature of IntoOwned::clone_onto
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmcsherry committed May 28, 2024
1 parent 46422dc commit 0b22519
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/trace/cursor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ pub trait IntoOwned<'a> {
/// Conversion from an instance of this type to the owned type.
fn into_owned(self) -> Self::Owned;
/// Clones `self` onto an existing instance of the owned type.
fn clone_onto(&self, other: &mut Self::Owned);
fn clone_onto(self, other: &mut Self::Owned);
/// Borrows an owned instance as oneself.
fn borrow_as(owned: &'a Self::Owned) -> Self;
}

impl<'a, T: ToOwned+?Sized> IntoOwned<'a> for &'a T {
type Owned = T::Owned;
fn into_owned(self) -> Self::Owned { self.to_owned() }
fn clone_onto(&self, other: &mut Self::Owned) { <T as ToOwned>::clone_into(self, other) }
fn clone_onto(self, other: &mut Self::Owned) { <T as ToOwned>::clone_into(self, other) }
fn borrow_as(owned: &'a Self::Owned) -> Self { owned.borrow() }
}

Expand Down
2 changes: 1 addition & 1 deletion src/trace/implementations/huffman_container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ mod wrapper {
Err(bytes) => bytes.to_vec(),
}
}
fn clone_onto(&self, other: &mut Self::Owned) {
fn clone_onto(self, other: &mut Self::Owned) {
other.clear();
match self.decode() {
Ok(decode) => other.extend(decode.cloned()),
Expand Down
4 changes: 2 additions & 2 deletions src/trace/implementations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ impl<'a> IntoOwned<'a> for usize {
self
}

fn clone_onto(&self, other: &mut Self::Owned) {
*other = *self;
fn clone_onto(self, other: &mut Self::Owned) {
*other = self;
}

fn borrow_as(owned: &'a Self::Owned) -> Self {
Expand Down

0 comments on commit 0b22519

Please sign in to comment.