tools: add ControlFlow type
modeled after std::ops::ControlFlow Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
134ed9e14f
commit
0b6d9442bd
11
src/tools.rs
11
src/tools.rs
@ -571,3 +571,14 @@ pub fn create_run_dir() -> Result<(), Error> {
|
||||
let _: bool = proxmox::tools::fs::create_path(PROXMOX_BACKUP_RUN_DIR_M!(), None, None)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Modeled after the nightly `std::ops::ControlFlow`.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum ControlFlow<B, C = ()> {
|
||||
Continue(C),
|
||||
Break(B),
|
||||
}
|
||||
|
||||
impl<B> ControlFlow<B> {
|
||||
pub const CONTINUE: ControlFlow<B, ()> = ControlFlow::Continue(());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user