Closed againstplag2022 closed 1 year ago
Have you: use tokio_util::compat::*;
?
yeah, same error
the following worked for testing:
[dependencies]
tokio = { version = "1.14.0", features = ["full"] }
bolt-client = {version = "0.10.1", features =["tokio-stream"]}
[dev-dependencies.tokio-util]
features = ["compat"]
version = "0.6.0"
and importing like the original example.
Hey @againstplag2022,
These libraries use asynchronous I/O, so you can't use synchronous I/O libraries like bufstream. The Stream
struct I've provided via the tokio-stream
feature implements the AsyncRead and AsyncWrite traits, and you can wrap it in a tokio BufStream as in the example.
However, if you're working on an application and you just need a way to easily get connections to your database, you should be using a connection pool instead, like deadpool, bb8, or mobc. I've published adapter crates for each of those three libraries. Here's an example of what using a connection pool might look like for a web application.
Let me know if you have any other questions!
Thank you very much for open sourcing this. This is definitely useful. Is it possible that a usage example being provided for this library? I tried to make the example here to work, but keep getting errors like the following:
currently I have this in my cargo.toml file:
and I have imports like this:
Not sure whether my cargo or import statements are correct. Would be great if a full example can be provided.