Skip to content

Commit

Permalink
Add paragraph to ControlFlow docs to menion it works with the ? opera…
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismit3s committed Oct 1, 2021
1 parent ed93759 commit 081fe30
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions library/core/src/ops/control_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ use crate::{convert, ops};
/// Having the enum makes it clearer -- no more wondering "wait, what did `false`
/// mean again?" -- and allows including a value.
///
/// Similar to [`Option`] and [`Result`], this enum can be used with the `?` operator
/// to return immediatly if the [`Break`] variant is present or to continue normally
/// with the value inside the [`Continue`] variant.
///
/// # Examples
///
/// Early-exiting from [`Iterator::try_for_each`]:
Expand Down Expand Up @@ -46,6 +50,9 @@ use crate::{convert, ops};
/// }
/// }
/// ```
///
/// [`Break`]: ControlFlow::Break
/// [`Continue`]: ControlFlow::Continue
#[stable(feature = "control_flow_enum_type", since = "1.55.0")]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ControlFlow<B, C = ()> {
Expand Down

0 comments on commit 081fe30

Please sign in to comment.