1
Fork 0

provide a more realistic example for BinaryHeap::as_slice

This commit is contained in:
Vlad Frolov 2021-03-13 17:21:56 +02:00
parent 6233f3f4a3
commit dd2b8a0444

View file

@ -899,13 +899,11 @@ impl<T> BinaryHeap<T> {
/// ``` /// ```
/// #![feature(binary_heap_as_slice)] /// #![feature(binary_heap_as_slice)]
/// use std::collections::BinaryHeap; /// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from(vec![1, 2, 3, 4, 5, 6, 7]); /// use std::io::{self, Write};
/// let slice = heap.as_slice();
/// ///
/// // Will print in some order /// let heap = BinaryHeap::from(vec![1, 2, 3, 4, 5, 6, 7]);
/// for x in slice { ///
/// println!("{}", x); /// io::sink().write(heap.as_slice()).unwrap();
/// }
/// ``` /// ```
#[unstable(feature = "binary_heap_as_slice", issue = "82331")] #[unstable(feature = "binary_heap_as_slice", issue = "82331")]
pub fn as_slice(&self) -> &[T] { pub fn as_slice(&self) -> &[T] {