Updating the loco version to any of 0.8 tags causes the chat-room example application to stop building with an unhandled trait
To Reproduce
Update the Cargo.toml loco version in the chat-rooms example to the following
[workspace]
[package]
name = "chat_rooms"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
loco-rs = { version = "0.8.0", default-features = false, features = [
"cli",
"channels",
] }
serde = "*"
serde_json = "*"
tokio = { version = "1.33.0", default-features = false }
async-trait = "0.1.74"
axum = "0.7.5"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] }
chrono = { version = "0.4", features = ["serde"] }
[[bin]]
name = "chat_rooms-cli"
path = "src/bin/main.rs"
required-features = []
When building this causes the following output
Compiling chat_rooms v0.1.0 (/home/dave/Projects/chat-rooms)
error[E0277]: the trait bound `{closure@src/channels/application.rs:21:9: 21:85}: MessageHandler<LocalAdapter, _>` is not satisfied
--> src/channels/application.rs:21:9
|
19 | socket.on(
| -- required by a bound introduced by this call
20 | "join",
21 | / |socket: SocketRef, Data::<String>(room), store: State<state::MessageStore>| async move {
22 | | tracing::info!("Received join: {:?}", room);
23 | | let _ = socket.leave_all();
24 | | let _ = socket.join(room.clone());
25 | | let messages = store.get(&room).await;
26 | | let _ = socket.emit("messages", Messages { messages });
27 | | },
| |_________^ the trait `MessageHandler<LocalAdapter, _>` is not implemented for closure `{closure@src/channels/application.rs:21:9: 21:85}`
|
note: required by a bound in `loco_rs::socketioxide::socket::Socket::<A>::on`
--> /home/dave/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socketioxide-0.14.1/src/socket.rs:225:12
|
223 | pub fn on<H, T>(&self, event: impl Into<Cow<'static, str>>, handler: H)
| -- required by a bound in this associated function
224 | where
225 | H: MessageHandler<A, T>,
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Socket::<A>::on`
error[E0277]: the trait bound `{closure@src/channels/application.rs:32:9: 32:88}: MessageHandler<LocalAdapter, _>` is not satisfied
--> src/channels/application.rs:32:9
|
30 | socket.on(
| -- required by a bound introduced by this call
31 | "message",
32 | / |socket: SocketRef, Data::<MessageIn>(data), store: State<state::MessageStore>| async move {
33 | | tracing::info!("Received message: {:?}", data);
34 | |
35 | | let response = state::Message {
... |
43 | | let _ = socket.within(data.room).emit("message", response);
44 | | },
| |_________^ the trait `MessageHandler<LocalAdapter, _>` is not implemented for closure `{closure@src/channels/application.rs:32:9: 32:88}`
|
note: required by a bound in `loco_rs::socketioxide::socket::Socket::<A>::on`
--> /home/dave/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socketioxide-0.14.1/src/socket.rs:225:12
|
223 | pub fn on<H, T>(&self, event: impl Into<Cow<'static, str>>, handler: H)
| -- required by a bound in this associated function
224 | where
225 | H: MessageHandler<A, T>,
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Socket::<A>::on`
error[E0277]: the trait bound `MessageStore: Clone` is not satisfied
--> src/app.rs:44:71
|
44 | let channels: AppChannels = AppChannels::builder().with_state(messages).into();
| ---------- ^^^^^^^^ the trait `Clone` is not implemented for `MessageStore`
| |
| required by a bound introduced by this call
|
note: required by a bound in `SocketIoBuilder::<A>::with_state`
--> /home/dave/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socketioxide-0.14.1/src/io.rs:178:26
|
178 | pub fn with_state<S: Clone + Send + Sync + 'static>(self, state: S) -> Self {
| ^^^^^ required by this bound in `SocketIoBuilder::<A>::with_state`
For more information about this error, try `rustc --explain E0277`.
Additional Context
I was attempting to move the chat-rooms example to the latest version of loco and got it working up to 0.7 and did need to make some code changes to src/bin/main.rs to remove the reference to eyre. But it does work with that change after moving to 0.7
Description
Updating the loco version to any of 0.8 tags causes the chat-room example application to stop building with an unhandled trait
To Reproduce Update the Cargo.toml loco version in the chat-rooms example to the following
When building this causes the following output
Expected Behavior
Application builds
Environment: Ubuntu 22.04 Output from
rustup show
Additional Context I was attempting to move the chat-rooms example to the latest version of loco and got it working up to 0.7 and did need to make some code changes to src/bin/main.rs to remove the reference to eyre. But it does work with that change after moving to 0.7