From d552ae9beae6404c13548b98ec7a7ec4e6b3dd90 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 21 Jul 2022 15:24:16 -0400 Subject: [Rust API] Better name for this trait fn, more CC support --- rust/src/metadata.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'rust/src/metadata.rs') diff --git a/rust/src/metadata.rs b/rust/src/metadata.rs index f7d5e45e..acc77a14 100644 --- a/rust/src/metadata.rs +++ b/rust/src/metadata.rs @@ -257,7 +257,7 @@ impl Metadata { let ptr: *mut BNMetadata = unsafe { BNMetadataGetForKey( self.handle, - key.as_bytes_with_nul().as_ref().as_ptr() as *const c_char, + key.into_bytes_with_nul().as_ref().as_ptr() as *const c_char, ) }; if ptr.is_null() { @@ -282,7 +282,7 @@ impl Metadata { unsafe { BNMetadataSetValueForKey( self.handle, - key.as_bytes_with_nul().as_ref().as_ptr() as *const c_char, + key.into_bytes_with_nul().as_ref().as_ptr() as *const c_char, value.handle, ) }; @@ -306,7 +306,7 @@ impl Metadata { unsafe { BNMetadataRemoveKey( self.handle, - key.as_bytes_with_nul().as_ref().as_ptr() as *const c_char, + key.into_bytes_with_nul().as_ref().as_ptr() as *const c_char, ) }; Ok(()) @@ -389,7 +389,7 @@ impl From for Ref { fn from(value: S) -> Self { unsafe { Metadata::ref_from_raw(BNCreateMetadataStringData( - value.as_bytes_with_nul().as_ref().as_ptr() as *const c_char, + value.into_bytes_with_nul().as_ref().as_ptr() as *const c_char, )) } } @@ -431,7 +431,7 @@ impl From>> for Ref { let mut keys: Vec<*const c_char> = vec![]; let mut values: Vec<*mut BNMetadata> = vec![]; for (k, v) in value.into_iter() { - key_refs.push(k.as_bytes_with_nul()); + key_refs.push(k.into_bytes_with_nul()); values.push(v.as_ref().handle); } for k in &key_refs { @@ -496,7 +496,7 @@ impl From> for Ref { fn from(value: Vec) -> Self { let mut refs = vec![]; for v in value { - refs.push(v.as_bytes_with_nul()); + refs.push(v.into_bytes_with_nul()); } let mut pointers = vec![]; for r in &refs { -- cgit v1.3.1