summaryrefslogtreecommitdiff
path: root/rust/src/settings.rs
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-07-21 15:24:16 -0400
committerGlenn Smith <glenn@vector35.com>2022-09-29 21:02:22 -0400
commitd552ae9beae6404c13548b98ec7a7ec4e6b3dd90 (patch)
tree00a2696b2a3a33b1ac5bb058801fdea9f1a38c03 /rust/src/settings.rs
parent2e18783a2f6e29c225d177e8a0fb866a9c9d85df (diff)
[Rust API] Better name for this trait fn, more CC support
Diffstat (limited to 'rust/src/settings.rs')
-rw-r--r--rust/src/settings.rs38
1 files changed, 19 insertions, 19 deletions
diff --git a/rust/src/settings.rs b/rust/src/settings.rs
index 83aa2df0..ba84acb7 100644
--- a/rust/src/settings.rs
+++ b/rust/src/settings.rs
@@ -41,7 +41,7 @@ impl Settings {
}
pub fn new<S: BnStrCompatible>(instance_id: S) -> Ref<Self> {
- let instance_id = instance_id.as_bytes_with_nul();
+ let instance_id = instance_id.into_bytes_with_nul();
unsafe {
let handle = BNCreateSettings(instance_id.as_ref().as_ptr() as *mut _);
@@ -52,7 +52,7 @@ impl Settings {
}
pub fn set_resource_id<S: BnStrCompatible>(&self, resource_id: S) {
- let resource_id = resource_id.as_bytes_with_nul();
+ let resource_id = resource_id.into_bytes_with_nul();
unsafe { BNSettingsSetResourceId(self.handle, resource_id.as_ref().as_ptr() as *mut _) };
}
@@ -61,7 +61,7 @@ impl Settings {
}
pub fn deserialize_schema<S: BnStrCompatible>(&self, schema: S) -> bool {
- let schema = schema.as_bytes_with_nul();
+ let schema = schema.into_bytes_with_nul();
unsafe {
BNSettingsDeserializeSchema(
self.handle,
@@ -73,7 +73,7 @@ impl Settings {
}
pub fn contains<S: BnStrCompatible>(&self, key: S) -> bool {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
unsafe { BNSettingsContains(self.handle, key.as_ref().as_ptr() as *mut _) }
}
@@ -84,7 +84,7 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<Box<SettingsScope>>,
) -> bool {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,
_ => ptr::null_mut() as *mut _,
@@ -109,7 +109,7 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<Box<SettingsScope>>,
) -> f64 {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,
_ => ptr::null_mut() as *mut _,
@@ -134,7 +134,7 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<Box<SettingsScope>>,
) -> u64 {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,
_ => ptr::null_mut() as *mut _,
@@ -159,7 +159,7 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<Box<SettingsScope>>,
) -> BnString {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,
_ => ptr::null_mut() as *mut _,
@@ -184,7 +184,7 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<Box<SettingsScope>>,
) -> Array<BnString> {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,
_ => ptr::null_mut() as *mut _,
@@ -215,7 +215,7 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<Box<SettingsScope>>,
) -> BnString {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,
_ => ptr::null_mut() as *mut _,
@@ -241,7 +241,7 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<SettingsScope>,
) {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,
_ => ptr::null_mut() as *mut _,
@@ -268,7 +268,7 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<SettingsScope>,
) {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,
_ => ptr::null_mut() as *mut _,
@@ -295,7 +295,7 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<SettingsScope>,
) {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,
_ => ptr::null_mut() as *mut _,
@@ -322,8 +322,8 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<SettingsScope>,
) {
- let key = key.as_bytes_with_nul();
- let value = value.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
+ let value = value.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,
_ => ptr::null_mut() as *mut _,
@@ -350,12 +350,12 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<SettingsScope>,
) -> bool {
- let key = key.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
let v = Vec::from_iter(value);
let mut value = vec![];
for item in v {
- value.push(item.as_bytes_with_nul().as_ref().as_ptr() as *const c_char);
+ value.push(item.into_bytes_with_nul().as_ref().as_ptr() as *const c_char);
}
let view_handle = match view {
@@ -387,8 +387,8 @@ impl Settings {
view: Option<&BinaryView>,
scope: Option<SettingsScope>,
) -> bool {
- let key = key.as_bytes_with_nul();
- let value = value.as_bytes_with_nul();
+ let key = key.into_bytes_with_nul();
+ let value = value.into_bytes_with_nul();
let view_handle = match view {
Some(view) => view.handle,