Skip to content

Commit 081fe30

Browse files
committed
Add paragraph to ControlFlow docs to menion it works with the ? operator (#88715)
1 parent ed93759 commit 081fe30

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/core/src/ops/control_flow.rs

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ use crate::{convert, ops};
77
/// Having the enum makes it clearer -- no more wondering "wait, what did `false`
88
/// mean again?" -- and allows including a value.
99
///
10+
/// Similar to [`Option`] and [`Result`], this enum can be used with the `?` operator
11+
/// to return immediatly if the [`Break`] variant is present or to continue normally
12+
/// with the value inside the [`Continue`] variant.
13+
///
1014
/// # Examples
1115
///
1216
/// Early-exiting from [`Iterator::try_for_each`]:
@@ -46,6 +50,9 @@ use crate::{convert, ops};
4650
/// }
4751
/// }
4852
/// ```
53+
///
54+
/// [`Break`]: ControlFlow::Break
55+
/// [`Continue`]: ControlFlow::Continue
4956
#[stable(feature = "control_flow_enum_type", since = "1.55.0")]
5057
#[derive(Debug, Clone, Copy, PartialEq)]
5158
pub enum ControlFlow<B, C = ()> {

0 commit comments

Comments
 (0)