#[repr(usize)]pub enum Flow {
Continue = 0,
Break = 1,
}Expand description
Represents the control flow of an operation, similar to ControlFlow.
This is a simplified enum that can be used with iterators and callbacks to indicate whether to continue or break early.
Variants§
Implementations§
Source§impl Flow
impl Flow
Sourcepub const fn is_continue(&self) -> bool
pub const fn is_continue(&self) -> bool
Returns true if this is Flow::Continue.
Sourcepub const fn into_control_flow(self) -> ControlFlow<()>
pub const fn into_control_flow(self) -> ControlFlow<()>
Converts this Flow into a ControlFlow that can be used with try_for_each.
use platform_data::Flow;
use std::ops::ControlFlow;
let mut count = 0;
let result = (0..10).try_for_each(|i| {
count += 1;
if i == 5 { Flow::Break.into_control_flow() } else { Flow::Continue.into_control_flow() }
});
assert_eq!(count, 6);Trait Implementations§
Source§impl<C, B> From<ControlFlow<C, B>> for Flow
impl<C, B> From<ControlFlow<C, B>> for Flow
Source§fn from(flow: ControlFlow<C, B>) -> Self
fn from(flow: ControlFlow<C, B>) -> Self
Converts to this type from the input type.
impl Copy for Flow
impl Eq for Flow
impl StructuralPartialEq for Flow
Auto Trait Implementations§
impl Freeze for Flow
impl RefUnwindSafe for Flow
impl Send for Flow
impl Sync for Flow
impl Unpin for Flow
impl UnsafeUnpin for Flow
impl UnwindSafe for Flow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more