提交 2eea1f30 编写于 作者: C Corey Farwell

Rewrite `slice::chunks` doc example to not require printing.

上级 1225e122
......@@ -577,15 +577,13 @@ pub fn windows(&self, size: usize) -> Windows<T> {
///
/// # Example
///
/// Print the slice two elements at a time (i.e. `[1,2]`,
/// `[3,4]`, `[5]`):
///
/// ```rust
/// let v = &[1, 2, 3, 4, 5];
///
/// for chunk in v.chunks(2) {
/// println!("{:?}", chunk);
/// }
/// ```
/// let slice = ['l', 'o', 'r', 'e', 'm'];
/// let mut iter = slice.chunks(2);
/// assert_eq!(iter.next().unwrap(), &['l', 'o']);
/// assert_eq!(iter.next().unwrap(), &['r', 'e']);
/// assert_eq!(iter.next().unwrap(), &['m']);
/// assert!(iter.next().is_none());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册