Skip to content

Commit 17015cd

Browse files
authored
Rollup merge of #76534 - notriddle:doc-comments, r=jyn514
Add doc comments for From impls #51430
2 parents 3a4de42 + 8b0d0a0 commit 17015cd

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

library/alloc/src/collections/binary_heap.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,10 @@ impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {
13431343

13441344
#[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
13451345
impl<T> From<BinaryHeap<T>> for Vec<T> {
1346+
/// Converts a `BinaryHeap<T>` into a `Vec<T>`.
1347+
///
1348+
/// This conversion requires no data movement or allocation, and has
1349+
/// constant time complexity.
13461350
fn from(heap: BinaryHeap<T>) -> Vec<T> {
13471351
heap.data
13481352
}

library/core/src/task/poll.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ impl<T, E> Poll<Option<Result<T, E>>> {
112112

113113
#[stable(feature = "futures_api", since = "1.36.0")]
114114
impl<T> From<T> for Poll<T> {
115+
/// Convert to a `Ready` variant.
116+
///
117+
/// # Example
118+
///
119+
/// ```
120+
/// # use core::task::Poll;
121+
/// assert_eq!(Poll::from(true), Poll::Ready(true));
122+
/// ```
115123
fn from(t: T) -> Poll<T> {
116124
Poll::Ready(t)
117125
}

0 commit comments

Comments
 (0)