summaryrefslogtreecommitdiff
path: root/rust/src/types.rs
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2022-08-16 11:46:55 -0400
committerKyleMiles <krm504@nyu.edu>2022-08-16 11:52:00 -0400
commit6b1078bd7e59eb35536b4147bb7134fd3cc68884 (patch)
tree99365bd4916dfb239c57e340176e6e68be59c9dc /rust/src/types.rs
parentdbaead2b359db5ee86118cc6bbca4c440b35a89b (diff)
Rust API : Implement more of the core enum `InstructionTextTokenType` in `InstructionTextTokenContents`; Fix some functions in types.rs not following the `T:
Into<Conf<...>>` convention
Diffstat (limited to 'rust/src/types.rs')
-rw-r--r--rust/src/types.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/rust/src/types.rs b/rust/src/types.rs
index 9648f300..34b1e597 100644
--- a/rust/src/types.rs
+++ b/rust/src/types.rs
@@ -395,7 +395,11 @@ impl TypeBuilder {
unsafe { Self::from_raw(BNCreateArrayTypeBuilder(&t.into().into(), count)) }
}
- pub fn enumeration(enumeration: &Enumeration, width: usize, is_signed: Conf<bool>) -> Self {
+ pub fn enumeration<T: Into<Conf<bool>>>(
+ enumeration: &Enumeration,
+ width: usize,
+ is_signed: T,
+ ) -> Self {
//! The C/C++ APIs require an associated architecture, but in the core we only query the default_int_size if the given width is 0
//! For simplicity's sake, that convention isn't followed and you can query the default_int_size from an arch, if you have it, if you need to
@@ -406,7 +410,7 @@ impl TypeBuilder {
&mut fake_arch,
enumeration.handle,
width,
- &mut is_signed.into(),
+ &mut is_signed.into().into(),
))
}
}
@@ -630,7 +634,8 @@ impl Type {
pub fn parameters(&self) -> Result<Vec<FunctionParameter<BnString>>> {
unsafe {
let mut count: usize = mem::zeroed();
- let parameters_raw: *mut BNFunctionParameter = BNGetTypeParameters(self.handle, &mut count);
+ let parameters_raw: *mut BNFunctionParameter =
+ BNGetTypeParameters(self.handle, &mut count);
if parameters_raw.is_null() {
Err(())
} else {
@@ -764,10 +769,10 @@ impl Type {
unsafe { Self::ref_from_raw(BNCreateArrayType(&t.into().into(), count)) }
}
- pub fn enumeration(
+ pub fn enumeration<T: Into<Conf<bool>>>(
enumeration: &Enumeration,
width: usize,
- is_signed: Conf<bool>,
+ is_signed: T,
) -> Ref<Self> {
//! The C/C++ APIs require an associated architecture, but in the core we only query the default_int_size if the given width is 0
//! For simplicity's sake, that convention isn't followed and you can query the default_int_size from an arch, if you have it, if you need to
@@ -778,7 +783,7 @@ impl Type {
&mut fake_arch,
enumeration.handle,
width,
- &mut is_signed.into(),
+ &mut is_signed.into().into(),
))
}
}