@@ -2440,16 +2440,11 @@ unsafe impl CoreArrayWrapper for QualifiedNameTypeAndId {
24402440//////////////////////////
24412441// NameAndType
24422442
2443- #[ repr( transparent) ]
24442443pub struct NameAndType ( pub ( crate ) BNNameAndType ) ;
24452444
24462445impl NameAndType {
2447- pub ( crate ) fn from_raw ( raw : & BNNameAndType ) -> Ref < Self > {
2448- Self :: new (
2449- raw_to_string ( raw. name ) . unwrap ( ) ,
2450- unsafe { & Type :: ref_from_raw ( raw. type_ ) } ,
2451- raw. typeConfidence ,
2452- )
2446+ pub ( crate ) unsafe fn from_raw ( raw : & BNNameAndType ) -> Self {
2447+ Self ( * raw )
24532448 }
24542449}
24552450
@@ -2464,10 +2459,6 @@ impl NameAndType {
24642459 }
24652460 }
24662461
2467- pub ( crate ) fn into_raw ( self ) -> BNNameAndType {
2468- self . 0
2469- }
2470-
24712462 pub fn name ( & self ) -> & str {
24722463 let c_str = unsafe { CStr :: from_ptr ( self . 0 . name ) } ;
24732464 c_str. to_str ( ) . unwrap ( )
@@ -2495,7 +2486,7 @@ unsafe impl RefCountable for NameAndType {
24952486 Self :: new (
24962487 CStr :: from_ptr ( handle. 0 . name ) ,
24972488 handle. t ( ) ,
2498- handle. type_with_confidence ( ) . confidence ,
2489+ handle. 0 . typeConfidence ,
24992490 )
25002491 }
25012492
@@ -2519,10 +2510,10 @@ unsafe impl CoreOwnedArrayProvider for NameAndType {
25192510}
25202511
25212512unsafe impl CoreArrayWrapper for NameAndType {
2522- type Wrapped < ' a > = & ' a NameAndType ;
2513+ type Wrapped < ' a > = Guard < ' a , NameAndType > ;
25232514
25242515 unsafe fn wrap_raw < ' a > ( raw : & ' a Self :: Raw , _context : & ' a Self :: Context ) -> Self :: Wrapped < ' a > {
2525- mem :: transmute ( raw)
2516+ unsafe { Guard :: new ( NameAndType :: from_raw ( raw) , raw ) }
25262517 }
25272518}
25282519
0 commit comments