Comments (4)
So I can't get async publish working or even set for that matter and the documentation is wrong. Any ideas?
from redis-rs.
Even the most basic example fails.
let channel_name = "my_channel"; // The channel ID as a string.
let message = "Hello, World!"; // The message you want to publish.
// Publish the message to the channel.
redis().publish(channel_name, message).await;
type annotations needed
cannot satisfy `_: FromRedisValue`
the following types implement trait `FromRedisValue`:
bool
isize
i8
i16
i32
i64
i128
usize
and 46 othersrustc[Click for full compiler diagnostic](rust-analyzer-diagnostics-view:/diagnostic%20message%20%5B0%5D?0#file%3A%2F%2F%2FUsers%2Foliverdixon%2FProjects%2Fprotobrain%2Fprotobrain-salvo%2Fsrc%2Ffeatures%2Fwebsockets%2Fwebsockets.rs)
macros.rs(167, 25): required by a bound in `redis::AsyncCommands::publish`
websockets.rs(118, 20): consider specifying the generic arguments: `::<&str, &str, RV>`
from redis-rs.
Also, the return type is fairly confusing. It also has to implement these traits?
error[E0277]: the trait bound `&Result<std::string::String, RedisError>: FromRedisValue` is not satisfied
--> src/features/websockets/websockets.rs:116:10
|
116 | .publish::<&RedisChannel, &ChannelData, &RedisResult<String>>(&channel, &data)
| ^^^^^^^ the trait `FromRedisValue` is not implemented for `&Result<std::string::String, RedisError>`
from redis-rs.
For anyone else stuck, it was the return type.
I had to wrap it in match
match redis().await.publish(&USER_MESSAGES, &data_string).await {
Ok(data) => data,
Err(e) => {
tracing::error!(error = ?e, "redis publish error");
return;
}
};
from redis-rs.
Related Issues (20)
- Async Cluster: Connection errors are hard to discover HOT 1
- Async Cluster: AWS Failover takes a long time to recover HOT 6
- `TlsConnParams` is opaque: Intentional? HOT 4
- add sentinel support in readme HOT 2
- Read timeouts on ConnectionManager in aio.rs HOT 6
- Response's value does not match the expected command's response value HOT 16
- allow disabling setinfo HOT 2
- Compile error: error[E0277]: `ActualConnection` doesn't implement `Debug` HOT 1
- Does `ClusterClient::new()` work with ElastiCache's configuration endpoint? HOT 3
- Async Cluster: Connection is created on each request HOT 6
- Opt-out client set info when creating new connection HOT 4
- execute config get databases error HOT 2
- Redis deletion is slow or some weird caching is enabled HOT 8
- redis execute `rpop` command got block HOT 10
- Backwards incompatible changes to consider HOT 14
- Unable to reuse a `SetOptions` instance after first command HOT 1
- Breaking Change HOT 7
- Async pubsub subscription misses messages HOT 3
- pubsub subscription with channel(2) but get data when channel full HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis-rs.