summaryrefslogtreecommitdiff
path: root/rust/src/types.rs
diff options
context:
space:
mode:
authorRyan Snyder <ryan@vector35.com>2024-05-01 10:43:58 -0400
committerRyan Snyder <ryan@vector35.com>2024-05-01 10:43:58 -0400
commit87b1470b2de74640c856d8a90ba88ec672713d71 (patch)
treeefcdf60ca4b7709b30221cf1e2898c6fc89254b8 /rust/src/types.rs
parent8817116bee33f3d8bee71fbd82b1220deb10993d (diff)
rust: account for changes to NameAndType bindings
Diffstat (limited to 'rust/src/types.rs')
-rw-r--r--rust/src/types.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/rust/src/types.rs b/rust/src/types.rs
index dae8a6cc..75c8fb36 100644
--- a/rust/src/types.rs
+++ b/rust/src/types.rs
@@ -2440,16 +2440,11 @@ unsafe impl CoreArrayWrapper for QualifiedNameTypeAndId {
//////////////////////////
// NameAndType
-#[repr(transparent)]
pub struct NameAndType(pub(crate) BNNameAndType);
impl NameAndType {
- pub(crate) fn from_raw(raw: &BNNameAndType) -> Ref<Self> {
- Self::new(
- raw_to_string(raw.name).unwrap(),
- unsafe { &Type::ref_from_raw(raw.type_) },
- raw.typeConfidence,
- )
+ pub(crate) unsafe fn from_raw(raw: &BNNameAndType) -> Self {
+ Self ( *raw )
}
}
@@ -2464,10 +2459,6 @@ impl NameAndType {
}
}
- pub(crate) fn into_raw(self) -> BNNameAndType {
- self.0
- }
-
pub fn name(&self) -> &str {
let c_str = unsafe { CStr::from_ptr(self.0.name) };
c_str.to_str().unwrap()
@@ -2495,7 +2486,7 @@ unsafe impl RefCountable for NameAndType {
Self::new(
CStr::from_ptr(handle.0.name),
handle.t(),
- handle.type_with_confidence().confidence,
+ handle.0.typeConfidence,
)
}
@@ -2519,10 +2510,10 @@ unsafe impl CoreOwnedArrayProvider for NameAndType {
}
unsafe impl CoreArrayWrapper for NameAndType {
- type Wrapped<'a> = &'a NameAndType;
+ type Wrapped<'a> = Guard<'a, NameAndType>;
unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
- mem::transmute(raw)
+ unsafe { Guard::new(NameAndType::from_raw(raw), raw) }
}
}