Skip to content

Commit 0316264

Browse files
committed
Gate AbstractType derive macro behind a derive feature-flag
1 parent ae2d483 commit 0316264

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

rust/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ edition = "2021"
66

77
[features]
88
noexports = []
9+
derive = ["binaryninja-derive", "elain"]
910

1011
[dependencies]
1112
lazy_static = "1.4.0"
1213
log = "0.4"
1314
libc = "0.2"
1415
rayon = { version = "1.8", optional = true }
1516
binaryninjacore-sys = { path = "binaryninjacore-sys" }
16-
binaryninja-derive = { path = "binaryninja-derive" }
17-
elain = "0.3.0"
17+
binaryninja-derive = { path = "binaryninja-derive", optional = true }
18+
# Const-generic alignment gadgetry used by the `AbstractType` derive macro
19+
elain = { version = "0.3.0", optional = true }
1820

1921
[patch.crates-io]
2022
# Patched pdb crate to implement some extra structures

rust/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ use std::path::PathBuf;
169169
pub use binaryninjacore_sys::BNBranchType as BranchType;
170170
pub use binaryninjacore_sys::BNEndianness as Endianness;
171171
use binaryview::BinaryView;
172+
#[cfg(feature = "derive")]
172173
pub use elain;
173174
use metadata::Metadata;
174175
use metadata::MetadataType;

rust/src/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ impl Drop for TypeBuilder {
691691
//////////
692692
// Type
693693

694+
#[cfg(feature = "derive")]
694695
pub use binaryninja_derive::*;
695696
pub trait AbstractType: Sized {
696697
const SIZE: usize = std::mem::size_of::<Self>();

0 commit comments

Comments
 (0)