update for loop desugaring docs
This commit is contained in:
parent
16156fb278
commit
29fe5930a3
1 changed files with 12 additions and 9 deletions
|
@ -547,15 +547,18 @@ mod fn_keyword {}
|
|||
/// # fn code() { }
|
||||
/// # let iterator = 0..2;
|
||||
/// {
|
||||
/// let mut _iter = std::iter::IntoIterator::into_iter(iterator);
|
||||
/// loop {
|
||||
/// match _iter.next() {
|
||||
/// Some(loop_variable) => {
|
||||
/// code()
|
||||
/// },
|
||||
/// None => break,
|
||||
/// }
|
||||
/// }
|
||||
/// let result = match IntoIterator::into_iter(iterator) {
|
||||
/// mut iter => loop {
|
||||
/// let next;
|
||||
/// match iter.next() {
|
||||
/// Some(val) => next = val,
|
||||
/// None => break,
|
||||
/// };
|
||||
/// let loop_variable = next;
|
||||
/// let () = { code(); };
|
||||
/// },
|
||||
/// };
|
||||
/// result
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue