From 0b6d9442bd0ec43065a6dc4d042461d6f52956d5 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 22 Apr 2021 16:01:53 +0200 Subject: [PATCH] tools: add ControlFlow type modeled after std::ops::ControlFlow Signed-off-by: Wolfgang Bumiller --- src/tools.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tools.rs b/src/tools.rs index 08af55e5d..890db8268 100644 --- a/src/tools.rs +++ b/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 { + Continue(C), + Break(B), +} + +impl ControlFlow { + pub const CONTINUE: ControlFlow = ControlFlow::Continue(()); +}