[pbs-devel] applied: [PATCH v2 backup 07/27] tools: add ControlFlow type
Dietmar Maurer
dietmar at proxmox.com
Thu Apr 29 11:17:06 CEST 2021
applied.
I guess we want to replace that with std::ops::ControlFlow once that is
stable?
On 4/22/21 4:01 PM, Wolfgang Bumiller wrote:
> modeled after std::ops::ControlFlow
>
> Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
> ---
> src/tools.rs | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/src/tools.rs b/src/tools.rs
> index 08af55e5..890db826 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<B, C = ()> {
> + Continue(C),
> + Break(B),
> +}
> +
> +impl<B> ControlFlow<B> {
> + pub const CONTINUE: ControlFlow<B, ()> = ControlFlow::Continue(());
> +}
More information about the pbs-devel
mailing list