iced_x86/
iced_features.rs

1// SPDX-License-Identifier: MIT
2// Copyright (C) 2018-present iced project and contributors
3
4/// Gets the available features
5#[doc(hidden)]
6#[allow(missing_copy_implementations)]
7#[allow(missing_debug_implementations)]
8pub struct IcedFeatures;
9
10impl IcedFeatures {
11	/// `true` if the gas (AT&T) formatter is available
12	#[must_use]
13	#[inline]
14	pub const fn has_gas() -> bool {
15		cfg!(feature = "gas")
16	}
17
18	/// `true` if the Intel (xed) formatter is available
19	#[must_use]
20	#[inline]
21	pub const fn has_intel() -> bool {
22		cfg!(feature = "intel")
23	}
24
25	/// `true` if the masm formatter is available
26	#[must_use]
27	#[inline]
28	pub const fn has_masm() -> bool {
29		cfg!(feature = "masm")
30	}
31
32	/// `true` if the nasm formatter is available
33	#[must_use]
34	#[inline]
35	pub const fn has_nasm() -> bool {
36		cfg!(feature = "nasm")
37	}
38
39	/// `true` if the fast formatter is available
40	#[must_use]
41	#[inline]
42	pub const fn has_fast_fmt() -> bool {
43		cfg!(feature = "fast_fmt")
44	}
45
46	/// `true` if the decoder is available
47	#[must_use]
48	#[inline]
49	pub const fn has_decoder() -> bool {
50		cfg!(feature = "decoder")
51	}
52
53	/// `true` if the encoder is available
54	#[must_use]
55	#[inline]
56	pub const fn has_encoder() -> bool {
57		cfg!(feature = "encoder")
58	}
59
60	/// `true` if the block encoder is available
61	#[must_use]
62	#[inline]
63	pub const fn has_block_encoder() -> bool {
64		cfg!(all(feature = "encoder", feature = "block_encoder"))
65	}
66
67	/// `true` if the opcode info is available
68	#[must_use]
69	#[inline]
70	pub const fn has_op_code_info() -> bool {
71		cfg!(all(feature = "encoder", feature = "op_code_info"))
72	}
73
74	/// `true` if the instruction info code is available
75	#[must_use]
76	#[inline]
77	pub const fn has_instruction_info() -> bool {
78		cfg!(feature = "instr_info")
79	}
80}