about summary refs log tree commit diff
path: root/library/core/src/ops
diff options
context:
space:
mode:
authorchrismit3s <chrissidtmeier@gmail.com>2021-10-01 21:55:35 +0200
committerchrismit3s <chrissidtmeier@gmail.com>2021-10-01 21:55:35 +0200
commit081fe300e7f9474d1c3cdf64e4c552b63dada607 (patch)
tree45a438c0074d774944858e7f701ed7b2dce175f9 /library/core/src/ops
parented937594d3912ced11f6f35a90bb8bf591909d2a (diff)
Add paragraph to ControlFlow docs to menion it works with the ? operator (#88715)
Diffstat (limited to 'library/core/src/ops')
-rw-r--r--library/core/src/ops/control_flow.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs
index cd2d57699c9..d46ed0f8485 100644
--- a/library/core/src/ops/control_flow.rs
+++ b/library/core/src/ops/control_flow.rs
@@ -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`]:
@@ -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 = ()> {