Skip to main content

intel_crashlog/source/
capability.rs

1// Copyright (C) 2026 Intel Corporation
2// SPDX-License-Identifier: MIT
3
4#[cfg(not(feature = "std"))]
5use alloc::{collections::BTreeSet, fmt};
6#[cfg(feature = "std")]
7use std::{collections::BTreeSet, fmt};
8
9/// Capability of a Crash Log source
10#[derive(Debug, Eq, Ord, PartialEq, PartialOrd)]
11pub enum Capability {
12    /// Extraction of the Crash Log records
13    Extract,
14    /// On-demand Crash Log collection
15    Trigger,
16    /// Enabling/Disabling of Crash Log collection flow
17    EnableDisable,
18    /// Clearing of the Crash Log storage
19    Clear,
20    /// Rearming of the Crash Log trigger
21    Rearm,
22}
23
24impl fmt::Display for Capability {
25    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
26        match self {
27            Self::Extract => write!(f, "extract"),
28            Self::Trigger => write!(f, "trigger"),
29            Self::EnableDisable => write!(f, "enable/disable"),
30            Self::Clear => write!(f, "clear"),
31            Self::Rearm => write!(f, "rearm"),
32        }
33    }
34}
35
36/// Set of all the capabilities supported by a Crash Log source
37pub type Capabilities = BTreeSet<Capability>;