1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// SPDX-License-Identifier: MIT
// Copyright (C) 2018-present iced project and contributors

/// Gets the available features
#[allow(missing_copy_implementations)]
#[allow(missing_debug_implementations)]
pub struct IcedFeatures;

impl IcedFeatures {
	/// `true` if the gas (AT&T) formatter is available
	#[must_use]
	#[inline]
	pub fn has_gas() -> bool {
		cfg!(feature = "gas")
	}

	/// `true` if the Intel (xed) formatter is available
	#[must_use]
	#[inline]
	pub fn has_intel() -> bool {
		cfg!(feature = "intel")
	}

	/// `true` if the masm formatter is available
	#[must_use]
	#[inline]
	pub fn has_masm() -> bool {
		cfg!(feature = "masm")
	}

	/// `true` if the nasm formatter is available
	#[must_use]
	#[inline]
	pub fn has_nasm() -> bool {
		cfg!(feature = "nasm")
	}

	/// `true` if the fast formatter is available
	#[must_use]
	#[inline]
	pub fn has_fast_fmt() -> bool {
		cfg!(feature = "fast_fmt")
	}

	/// `true` if the decoder is available
	#[must_use]
	#[inline]
	pub fn has_decoder() -> bool {
		cfg!(feature = "decoder")
	}

	/// `true` if the encoder is available
	#[must_use]
	#[inline]
	pub fn has_encoder() -> bool {
		cfg!(feature = "encoder")
	}

	/// `true` if the block encoder is available
	#[must_use]
	#[inline]
	pub fn has_block_encoder() -> bool {
		cfg!(all(feature = "encoder", feature = "block_encoder"))
	}

	/// `true` if the opcode info is available
	#[must_use]
	#[inline]
	pub fn has_op_code_info() -> bool {
		cfg!(all(feature = "encoder", feature = "op_code_info"))
	}

	/// `true` if the instruction info code is available
	#[must_use]
	#[inline]
	pub fn has_instruction_info() -> bool {
		cfg!(feature = "instr_info")
	}
}