Skip to content

Commit b7002f6

Browse files
Update some examples (#364)
1 parent afabded commit b7002f6

File tree

5 files changed

+22
-16
lines changed

5 files changed

+22
-16
lines changed

examples/chat/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ publish = false
66

77
[dependencies]
88
axum = { path = "../..", features = ["ws"] }
9-
tokio = { version = "1.0", features = ["full"] }
9+
futures = "0.3"
10+
tokio = { version = "1", features = ["full"] }
1011
tower = { version = "0.4", features = ["util"] }
1112
tracing = "0.1"
1213
tracing-subscriber = "0.2"
13-
futures = "0.3"

examples/chat/src/main.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,21 @@
66
//! cargo run -p example-chat
77
//! ```
88
9-
use axum::extract::ws::{Message, WebSocket, WebSocketUpgrade};
10-
use axum::extract::Extension;
11-
use axum::handler::get;
12-
use axum::response::{Html, IntoResponse};
13-
use axum::AddExtensionLayer;
14-
use axum::Router;
9+
use axum::{
10+
extract::{
11+
ws::{Message, WebSocket, WebSocketUpgrade},
12+
Extension,
13+
},
14+
handler::get,
15+
response::{Html, IntoResponse},
16+
AddExtensionLayer, Router,
17+
};
1518
use futures::{sink::SinkExt, stream::StreamExt};
16-
use std::collections::HashSet;
17-
use std::net::SocketAddr;
18-
use std::sync::{Arc, Mutex};
19+
use std::{
20+
collections::HashSet,
21+
net::SocketAddr,
22+
sync::{Arc, Mutex},
23+
};
1924
use tokio::sync::broadcast;
2025

2126
// Our shared state

examples/low-level-rustls/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ publish = false
66

77
[dependencies]
88
axum = { path = "../.." }
9-
tokio = { version = "1.0", features = ["full"] }
9+
hyper = { version = "0.14", features = ["full"] }
10+
tokio = { version = "1", features = ["full"] }
11+
tokio-rustls = "0.22"
1012
tracing = "0.1"
1113
tracing-subscriber = "0.2"
12-
tokio-rustls = "0.22.0"
13-
hyper = { version = "0.14", features = ["full"] }

examples/low-level-rustls/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use std::{fs::File, io::BufReader, sync::Arc};
1010
use tokio::net::TcpListener;
1111
use tokio_rustls::{
1212
rustls::{
13-
internal::pemfile::certs, internal::pemfile::pkcs8_private_keys, NoClientAuth, ServerConfig,
13+
internal::pemfile::{certs, pkcs8_private_keys},
14+
NoClientAuth, ServerConfig,
1415
},
1516
TlsAcceptor,
1617
};

examples/tls-rustls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ publish = false
66

77
[dependencies]
88
axum = { path = "../.." }
9-
axum-server = { version = "0.1", features = ["tls-rustls"] }
9+
axum-server = { version = "0.2", features = ["tls-rustls"] }
1010
tokio = { version = "1", features = ["full"] }
1111
tracing = "0.1"
1212
tracing-subscriber = "0.2"

0 commit comments

Comments
 (0)