fidl_data_zbi/
reboot.rs

1// Copyright 2022 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// DO NOT EDIT.
6// Generated from FIDL library `zbi` by zither, a Fuchsia platform tool.
7
8#![allow(unused_imports)]
9
10use zerocopy::IntoBytes;
11
12/// ZBI_TYPE_HW_REBOOT_REASON payload.
13#[repr(u32)]
14#[derive(Clone, Copy, Debug, Eq, IntoBytes, PartialEq)]
15pub enum HwRebootReason {
16    Undefined = 0,
17    Cold = 1,
18    Warm = 2,
19    Brownout = 3,
20    Watchdog = 4,
21}
22
23impl HwRebootReason {
24    pub fn from_raw(raw: u32) -> Option<Self> {
25        match raw {
26            0 => Some(Self::Undefined),
27
28            1 => Some(Self::Cold),
29
30            2 => Some(Self::Warm),
31
32            3 => Some(Self::Brownout),
33
34            4 => Some(Self::Watchdog),
35
36            _ => None,
37        }
38    }
39}