From b7002f68d5de5488298614af173f5dc1c357e3a4 Mon Sep 17 00:00:00 2001 From: Eray Karatay <70590982+programatik29@users.noreply.github.com> Date: Tue, 5 Oct 2021 08:50:27 +0300 Subject: [PATCH] Update some examples (#364) --- examples/chat/Cargo.toml | 4 ++-- examples/chat/src/main.rs | 23 ++++++++++++++--------- examples/low-level-rustls/Cargo.toml | 6 +++--- examples/low-level-rustls/src/main.rs | 3 ++- examples/tls-rustls/Cargo.toml | 2 +- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/examples/chat/Cargo.toml b/examples/chat/Cargo.toml index ffaf1002..caac5502 100644 --- a/examples/chat/Cargo.toml +++ b/examples/chat/Cargo.toml @@ -6,8 +6,8 @@ publish = false [dependencies] axum = { path = "../..", features = ["ws"] } -tokio = { version = "1.0", features = ["full"] } +futures = "0.3" +tokio = { version = "1", features = ["full"] } tower = { version = "0.4", features = ["util"] } tracing = "0.1" tracing-subscriber = "0.2" -futures = "0.3" diff --git a/examples/chat/src/main.rs b/examples/chat/src/main.rs index a44ae298..0e35137f 100644 --- a/examples/chat/src/main.rs +++ b/examples/chat/src/main.rs @@ -6,16 +6,21 @@ //! cargo run -p example-chat //! ``` -use axum::extract::ws::{Message, WebSocket, WebSocketUpgrade}; -use axum::extract::Extension; -use axum::handler::get; -use axum::response::{Html, IntoResponse}; -use axum::AddExtensionLayer; -use axum::Router; +use axum::{ + extract::{ + ws::{Message, WebSocket, WebSocketUpgrade}, + Extension, + }, + handler::get, + response::{Html, IntoResponse}, + AddExtensionLayer, Router, +}; use futures::{sink::SinkExt, stream::StreamExt}; -use std::collections::HashSet; -use std::net::SocketAddr; -use std::sync::{Arc, Mutex}; +use std::{ + collections::HashSet, + net::SocketAddr, + sync::{Arc, Mutex}, +}; use tokio::sync::broadcast; // Our shared state diff --git a/examples/low-level-rustls/Cargo.toml b/examples/low-level-rustls/Cargo.toml index 5472470a..b9650cfa 100644 --- a/examples/low-level-rustls/Cargo.toml +++ b/examples/low-level-rustls/Cargo.toml @@ -6,8 +6,8 @@ publish = false [dependencies] axum = { path = "../.." } -tokio = { version = "1.0", features = ["full"] } +hyper = { version = "0.14", features = ["full"] } +tokio = { version = "1", features = ["full"] } +tokio-rustls = "0.22" tracing = "0.1" tracing-subscriber = "0.2" -tokio-rustls = "0.22.0" -hyper = { version = "0.14", features = ["full"] } diff --git a/examples/low-level-rustls/src/main.rs b/examples/low-level-rustls/src/main.rs index ebeb84f2..b82e6d56 100644 --- a/examples/low-level-rustls/src/main.rs +++ b/examples/low-level-rustls/src/main.rs @@ -10,7 +10,8 @@ use std::{fs::File, io::BufReader, sync::Arc}; use tokio::net::TcpListener; use tokio_rustls::{ rustls::{ - internal::pemfile::certs, internal::pemfile::pkcs8_private_keys, NoClientAuth, ServerConfig, + internal::pemfile::{certs, pkcs8_private_keys}, + NoClientAuth, ServerConfig, }, TlsAcceptor, }; diff --git a/examples/tls-rustls/Cargo.toml b/examples/tls-rustls/Cargo.toml index b552d189..2b97ed83 100644 --- a/examples/tls-rustls/Cargo.toml +++ b/examples/tls-rustls/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] axum = { path = "../.." } -axum-server = { version = "0.1", features = ["tls-rustls"] } +axum-server = { version = "0.2", features = ["tls-rustls"] } tokio = { version = "1", features = ["full"] } tracing = "0.1" tracing-subscriber = "0.2"