Skip to content

Commit 71de148

Browse files
committed
Advertise Vec in LinkedList docs
1 parent 368e092 commit 71de148

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/libcollections/linked_list.rs

+17-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@
1010

1111
//! A doubly-linked list with owned nodes.
1212
//!
13-
//! The `LinkedList` allows pushing and popping elements at either end and is thus
14-
//! efficiently usable as a double-ended queue.
13+
//! The `LinkedList` allows pushing and popping elements at either end
14+
//! in constant time.
15+
//!
16+
//! Almost always it is better to use `Vec` or [`VecDeque`] instead of
17+
//! [`LinkedList`]. In general, array-based containers are faster,
18+
//! more memory efficient and make better use of CPU cache.
19+
//!
20+
//! [`LinkedList`]: ../linked_list/struct.LinkedList.html
21+
//! [`VecDeque`]: ../vec_deque/struct.VecDeque.html
1522
1623
#![stable(feature = "rust1", since = "1.0.0")]
1724

@@ -27,7 +34,14 @@ use core::ptr::{self, Shared};
2734

2835
use super::SpecExtend;
2936

30-
/// A doubly-linked list.
37+
/// A doubly-linked list with owned nodes.
38+
///
39+
/// The `LinkedList` allows pushing and popping elements at either end
40+
/// in constant time.
41+
///
42+
/// Almost always it is better to use `Vec` or `VecDeque` instead of
43+
/// `LinkedList`. In general, array-based containers are faster,
44+
/// more memory efficient and make better use of CPU cache.
3145
#[stable(feature = "rust1", since = "1.0.0")]
3246
pub struct LinkedList<T> {
3347
head: Option<Shared<Node<T>>>,

0 commit comments

Comments
 (0)