Skip to content

Implement Clone::clone_from for BitVec#246

Open
willcrichton wants to merge 1 commit intoferrilab:mainfrom
willcrichton:main
Open

Implement Clone::clone_from for BitVec#246
willcrichton wants to merge 1 commit intoferrilab:mainfrom
willcrichton:main

Conversation

@willcrichton
Copy link
Copy Markdown

The default implementation of clone_from is just *self = other.clone(), which involves an unnecessary allocation if self.len() == other.len(). This PR provides a Clone::clone_from implementation that calls copy_from_bitslice when applicable.

Copy link
Copy Markdown
Contributor

@pczarn pczarn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants