Skip to content

Commit

Permalink
provide a more realistic example for BinaryHeap::as_slice
Browse files Browse the repository at this point in the history
  • Loading branch information
frol committed Mar 13, 2021
1 parent 6233f3f commit dd2b8a0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions library/alloc/src/collections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,13 +899,11 @@ impl<T> BinaryHeap<T> {
/// ```
/// #![feature(binary_heap_as_slice)]
/// use std::collections::BinaryHeap;
/// use std::io::{self, Write};
///
/// let heap = BinaryHeap::from(vec![1, 2, 3, 4, 5, 6, 7]);
/// let slice = heap.as_slice();
///
/// // Will print in some order
/// for x in slice {
/// println!("{}", x);
/// }
/// io::sink().write(heap.as_slice()).unwrap();
/// ```
#[unstable(feature = "binary_heap_as_slice", issue = "82331")]
pub fn as_slice(&self) -> &[T] {
Expand Down

0 comments on commit dd2b8a0

Please sign in to comment.