Stabilize the map/value methods on ControlFlow · qinheping/verify-rust-std@a781a4a (original) (raw)

`@@ -171,14 +171,13 @@ impl<B, C> ControlFlow<B, C> {

`

171

171

`/// # Examples

`

172

172

`///

`

173

173

```` /// ```


`174`

``

`-

/// #![feature(control_flow_enum)]

`

`175`

`174`

`/// use std::ops::ControlFlow;

`

`176`

`175`

`///

`

`177`

`176`

`/// assert_eq!(ControlFlow::<i32, String>::Break(3).break_value(), Some(3));

`

`178`

`177`

`/// assert_eq!(ControlFlow::<String, i32>::Continue(3).break_value(), None);

`

`179`

`178`

```` /// ```

180

179

`#[inline]

`

181

``

`-

#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]

`

``

180

`+

#[stable(feature = "control_flow_enum", since = "CURRENT_RUSTC_VERSION")]

`

182

181

`pub fn break_value(self) -> Option {

`

183

182

`match self {

`

184

183

`ControlFlow::Continue(..) => None,

`

`@@ -189,11 +188,8 @@ impl<B, C> ControlFlow<B, C> {

`

189

188

`` /// Maps ControlFlow<B, C> to ControlFlow<T, C> by applying a function

``

190

189

`/// to the break value in case it exists.

`

191

190

`#[inline]

`

192

``

`-

#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]

`

193

``

`-

pub fn map_break<T, F>(self, f: F) -> ControlFlow<T, C>

`

194

``

`-

where

`

195

``

`-

F: FnOnce(B) -> T,

`

196

``

`-

{

`

``

191

`+

#[stable(feature = "control_flow_enum", since = "CURRENT_RUSTC_VERSION")]

`

``

192

`+

pub fn map_break(self, f: impl FnOnce(B) -> T) -> ControlFlow<T, C> {

`

197

193

`match self {

`

198

194

`ControlFlow::Continue(x) => ControlFlow::Continue(x),

`

199

195

`ControlFlow::Break(x) => ControlFlow::Break(f(x)),

`

`@@ -206,14 +202,13 @@ impl<B, C> ControlFlow<B, C> {

`

206

202

`/// # Examples

`

207

203

`///

`

208

204

```` /// ```


`209`

``

`-

/// #![feature(control_flow_enum)]

`

`210`

`205`

`/// use std::ops::ControlFlow;

`

`211`

`206`

`///

`

`212`

`207`

`/// assert_eq!(ControlFlow::<i32, String>::Break(3).continue_value(), None);

`

`213`

`208`

`/// assert_eq!(ControlFlow::<String, i32>::Continue(3).continue_value(), Some(3));

`

`214`

`209`

```` /// ```

215

210

`#[inline]

`

216

``

`-

#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]

`

``

211

`+

#[stable(feature = "control_flow_enum", since = "CURRENT_RUSTC_VERSION")]

`

217

212

`pub fn continue_value(self) -> Option {

`

218

213

`match self {

`

219

214

`ControlFlow::Continue(x) => Some(x),

`

`@@ -224,11 +219,8 @@ impl<B, C> ControlFlow<B, C> {

`

224

219

`` /// Maps ControlFlow<B, C> to ControlFlow<B, T> by applying a function

``

225

220

`/// to the continue value in case it exists.

`

226

221

`#[inline]

`

227

``

`-

#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]

`

228

``

`-

pub fn map_continue<T, F>(self, f: F) -> ControlFlow<B, T>

`

229

``

`-

where

`

230

``

`-

F: FnOnce(C) -> T,

`

231

``

`-

{

`

``

222

`+

#[stable(feature = "control_flow_enum", since = "CURRENT_RUSTC_VERSION")]

`

``

223

`+

pub fn map_continue(self, f: impl FnOnce(C) -> T) -> ControlFlow<B, T> {

`

232

224

`match self {

`

233

225

`ControlFlow::Continue(x) => ControlFlow::Continue(f(x)),

`

234

226

`ControlFlow::Break(x) => ControlFlow::Break(x),

`