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}
21
22impl fmt::Display for Capability {
23    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
24        match self {
25            Self::Extract => write!(f, "extract"),
26            Self::Trigger => write!(f, "trigger"),
27            Self::EnableDisable => write!(f, "enable/disable"),
28            Self::Clear => write!(f, "clear"),
29        }
30    }
31}
32
33/// Set of all the capabilities supported by a Crash Log source
34pub type Capabilities = BTreeSet<Capability>;