Skip to main content

neo_decompiler/decompiler/
output_format.rs

1#[cfg(feature = "cli")]
2use clap::ValueEnum;
3
4/// Select which decompiler outputs should be generated.
5#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
6#[cfg_attr(feature = "cli", derive(ValueEnum))]
7pub enum OutputFormat {
8    /// Emit pseudocode output.
9    Pseudocode,
10    /// Emit a higher-level structured output.
11    HighLevel,
12    /// Emit C# source code output.
13    CSharp,
14    /// Emit all supported outputs.
15    #[default]
16    All,
17}
18
19impl OutputFormat {
20    pub(super) fn wants_pseudocode(self) -> bool {
21        matches!(self, OutputFormat::Pseudocode | OutputFormat::All)
22    }
23
24    pub(super) fn wants_high_level(self) -> bool {
25        matches!(self, OutputFormat::HighLevel | OutputFormat::All)
26    }
27
28    pub(super) fn wants_csharp(self) -> bool {
29        matches!(self, OutputFormat::CSharp | OutputFormat::All)
30    }
31}