Skip to content

Commit 443ac55

Browse files
A6GibKmbilelmoussaoui
authored andcommitted
Use zvariant::Value::try_into_owned
Like try_to_owned, but without unnecessary allocations. This method was introduced in zvariant 5.7: https://github.com/dbus2/zbus/pull/1440/files.
1 parent 7f51d4c commit 443ac55

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ tokio = { version = "1.47", default-features = false }
3535
tempfile = "3.21"
3636
tracing = "0.1"
3737
tracing-subscriber = "0.3"
38-
zbus = { version = "5.9", default-features = false }
38+
zbus = { version = "5.9.1", default-features = false }
3939
zbus_macros = {version = "5.5", features = ["gvariant"]}
4040
zeroize = { version = "1", features = ["zeroize_derive"] }

client/src/key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl From<Key> for zvariant::Value<'static> {
6666

6767
impl From<Key> for zvariant::OwnedValue {
6868
fn from(key: Key) -> Self {
69-
zvariant::Value::from(key).try_to_owned().unwrap()
69+
zvariant::Value::from(key).try_into_owned().unwrap()
7070
}
7171
}
7272

server/src/gnome/prompter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl PrompterCallback {
346346

347347
let signal_emitter = self.service.signal_emitter(prompt_path)?;
348348
let result = zvariant::Value::new(prompt.objects())
349-
.try_to_owned()
349+
.try_into_owned()
350350
.unwrap();
351351

352352
tokio::spawn(async move {
@@ -387,7 +387,7 @@ impl PrompterCallback {
387387
tokio::spawn(async move { prompter.stop_prompting(&path).await });
388388
let signal_emitter = self.service.signal_emitter(prompt_path)?;
389389
let result = zvariant::Value::new::<Vec<OwnedObjectPath>>(vec![])
390-
.try_to_owned()
390+
.try_into_owned()
391391
.unwrap();
392392

393393
tokio::spawn(async move { Prompt::completed(&signal_emitter, true, result).await });

server/src/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl Service {
9898

9999
let service_key = public_key
100100
.map(OwnedValue::from)
101-
.unwrap_or_else(|| Value::new::<Vec<u8>>(vec![]).try_to_owned().unwrap());
101+
.unwrap_or_else(|| Value::new::<Vec<u8>>(vec![]).try_into_owned().unwrap());
102102

103103
Ok((service_key, path))
104104
}

0 commit comments

Comments
 (0)