hwchen / secret-service-rs

Rust library for interfacing with Secret Service API
Apache License 2.0
73 stars 28 forks source link

Update to zbus 3 #50

Closed complexspaces closed 2 years ago

complexspaces commented 2 years ago

This PR starts the process of updating to the upcoming version of zbus 3.0. The most notable change made in the new major version is much tighter integration with tokio with the relevant feature, which significantly reduces the number of dependencies required to use zbus in a Tokio-centric build tree.

Dependencies built invoking cargo test --no-default-features --features tokio: 3.0: 143 2.0: 154

The build times between the two branches are about as expected given the size of tokio vs async-std. I would not consider these changes a win for compile times despite the lower dependency count.

All tests pass on Ubuntu 22.04.

Closes #42

zeenix commented 2 years ago

The build times between the two branches are about as expected given the size of tokio vs async-std

There may be a confusion here still. zbus does not depend on async-std. It makes use of the smol-rs crates though, which are designed to be as small and self-contained as possible.

I would not consider these changes a win for compile times despite the lower dependency count.

This doesn't surprise me really. If you recall, I did try and make a point about this in #42. Practically speaking, this won't bring any significant benefits to the table, even if I removed the remaining smol-rs dep: async-broadcast.

zeenix commented 2 years ago

I would not consider these changes a win for compile times despite the lower dependency count.

This doesn't surprise me really. If you recall, I did try and make a point about this in #42. Practically speaking, this won't bring any significant benefits to the table, even if I removed the remaining smol-rs dep: async-broadcast.

This is not to say 3.0 doesn't bring real benefits for tokio users. 3.0 does bring tighter integration with the runtime itself so all the tokio tools will work out of the box with zbus now. E.g all internal tasks are now tokio tasks launched in whatever application runtime zbus API is used with.

These benefits are unrelated to lowered dependencies though.

complexspaces commented 2 years ago

There may be a confusion here still. zbus does not depend on async-std. It makes use of the smol-rs crates though, which are designed to be as small and self-contained as possible.

Sorry, that was poorly worded on my part. In my mind the async-* crate ecosystem makes up "async-std" and that was what I was referring to via the async-io feature of zbus. I understand that zbus does not literally depend on that crate.

This doesn't surprise me really. If you recall, I did try and make a point about this in https://github.com/hwchen/secret-service-rs/issues/42. Practically speaking, this won't bring any significant benefits to the table, even if I removed the remaining smol-rs dep: async-broadcast.

This is not to say 3.0 doesn't bring real benefits for tokio users. 3.0 does bring tighter integration with the runtime itself so all the tokio tools will work out of the box with zbus now. E.g all internal tasks are not tokio tasks launched in whatever application runtime zbus API is used with.

These benefits are unrelated to lowered dependencies though.

I'm with you on those points 💯. The lowered dependencies is nice for auditing processes and the better integration is great because it avoids more cases where you'll get panics if you try using Tokio-specific utilities.

zeenix commented 2 years ago

E.g all internal tasks are not tokio tasks launched in whatever application runtime zbus API is used with.

Just to be clear, the "not" here was a typo. It's "now". :)