mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-19 03:54:40 +00:00
Add paragraph to ControlFlow docs to menion it works with the ? operator (#88715)
This commit is contained in:
parent
ed937594d3
commit
081fe300e7
@ -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 = ()> {
|
||||
|
Loading…
Reference in New Issue
Block a user