locka99 / opcua

A client and server implementation of the OPC UA specification written in Rust
Mozilla Public License 2.0
480 stars 129 forks source link

Use tokio version "1" #169

Closed laumann closed 2 years ago

laumann commented 2 years ago

We use tokio 1.16 internally meaning that we cannot select a compatible version when using this library as a dependency.

I only want the version requirements to be a little more lax, not necessarily "1" but I thought this could get us started :-)

laumann commented 2 years ago

An alternative is ">=1.15" I suppose if you just want to go for a minimum version.

EDIT I guess it'd be better to do:

version = "^1.15"

From caret requirements

svanharmelen commented 2 years ago

We have the same issue and currently use a forked branch because of this. Would be very nice if this constraint could be relaxed just a little...

laumann commented 2 years ago

@svanharmelen Good to know. What version of tokio do you use?

svanharmelen commented 2 years ago

1.17 at the moment...

locka99 commented 2 years ago

If I loosen it though, wouldn't that completely mess up the lock file?

laumann commented 2 years ago

If I loosen it though, wouldn't that completely mess up the lock file?

I don't think so. You made me wonder why there weren't any changes to Cargo.lock, but there shouldn't be any. As I understand Cargo.lock, it just records the version of a dependency that was chosen at some point, whereas the dependency specification in Cargo.toml puts bounds on the accepted versions of dependencies.

With this change, if you run cargo update you'd probably get the tokio versions bumped to 1.17 (or whatever's latest) in Cargo.lock, but until that point nothing should change.

svanharmelen commented 2 years ago

Indeed it doesn't directly impact the lockfile in this repo (only when you update), but when using the client as a library you are not using the lockfile in this repo. Instead you will use the lockfile that is associated with your own binary.

locka99 commented 2 years ago

I've changed the deps to be 1 for tokio and 0.6 for tokio-util. This PR can therefore be closed. I think if it causes issues I'll have to be more specific but I'll leave it like this for now.

laumann commented 2 years ago

Thanks!

svanharmelen commented 2 years ago

Nice 👍🏻

lovasoa commented 2 years ago

Cool ! Could this be pushed to crates.io ? The latest version in the repo seems to still depend on tokio 0.1...

locka99 commented 2 years ago

I'm thinking of publishing 0.9 soon to get on with async client as 0.10 but I have to go through things to make sure there are no regressions.

laumann commented 2 years ago

I'm thinking of publishing 0.9 soon to get on with async client as 0.10 but I have to go through things to make sure there are no regressions.

Nice! Anything you need in that regard? I made a sample browse-client (to scan the address space of an OPC-UA server) - would you be interested in including that?