Skip to content

Added from_vec and into_sorted_vec for BinaryHeap#576

Open
silyevsk wants to merge 2 commits intorust-embedded:mainfrom
silyevsk:from_vec
Open

Added from_vec and into_sorted_vec for BinaryHeap#576
silyevsk wants to merge 2 commits intorust-embedded:mainfrom
silyevsk:from_vec

Conversation

@silyevsk
Copy link
Copy Markdown

@silyevsk silyevsk commented May 5, 2025

Implemented:

  • creating BinaryHeap from Vec in-place
  • converting BinaryHeap into sorted Vec in-place

Copy link
Copy Markdown
Member

@BartMassey BartMassey left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for this! Apologies for our very slow response.

Copy link
Copy Markdown
Contributor

@sgued sgued left a comment

Choose a reason for hiding this comment

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

Sorry for the slow reply from me too.
Thank you for the PR, it mostly looks good to me.
Please rebase on top of main to fix the conflict and squash the two commits to keep history clean.

/// assert_eq!(heap.capacity(), 12);
/// assert_eq!(heap.peek(), Some(&9));
/// ```
pub fn from_vec(vec: Vec<T, N, usize>) -> Self
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not implement From<Vec<T, N, Usize>> ? This would be in line with std's implementation.

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.

3 participants