mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-07 00:00:12 +02:00
Update to syn 2 (#1862)
This commit is contained in:
@@ -15,7 +15,7 @@ version = "0.3.3" # remember to also bump the version that axum depends on
|
|||||||
__private_docs = ["dep:tower-http"]
|
__private_docs = ["dep:tower-http"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1"
|
async-trait = "0.1.67"
|
||||||
bytes = "1.0"
|
bytes = "1.0"
|
||||||
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
|
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
|
||||||
http = "0.2.7"
|
http = "0.2.7"
|
||||||
@@ -32,7 +32,7 @@ rustversion = "1.0.9"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
axum = { path = "../axum", version = "0.6.0", features = ["headers"] }
|
axum = { path = "../axum", version = "0.6.0", features = ["headers"] }
|
||||||
futures-util = "0.3"
|
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
|
||||||
hyper = "0.14.24"
|
hyper = "0.14.24"
|
||||||
tokio = { version = "1.25.0", features = ["macros"] }
|
tokio = { version = "1.25.0", features = ["macros"] }
|
||||||
tower-http = { version = "0.4", features = ["limit"] }
|
tower-http = { version = "0.4", features = ["limit"] }
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ tokio-util = { version = "0.7", optional = true }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
axum = { path = "../axum", version = "0.6.0", features = ["headers"] }
|
axum = { path = "../axum", version = "0.6.0", features = ["headers"] }
|
||||||
futures = "0.3"
|
|
||||||
http-body = "0.4.4"
|
http-body = "0.4.4"
|
||||||
hyper = "0.14"
|
hyper = "0.14"
|
||||||
reqwest = { version = "0.11", default-features = false, features = ["json", "stream", "multipart"] }
|
reqwest = { version = "0.11", default-features = false, features = ["json", "stream", "multipart"] }
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ pin_project! {
|
|||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use axum_extra::json_lines::JsonLines;
|
/// use axum_extra::json_lines::JsonLines;
|
||||||
/// use futures::stream::StreamExt;
|
/// use futures_util::stream::StreamExt;
|
||||||
///
|
///
|
||||||
/// async fn handler(mut stream: JsonLines<serde_json::Value>) {
|
/// async fn handler(mut stream: JsonLines<serde_json::Value>) {
|
||||||
/// while let Some(value) = stream.next().await {
|
/// while let Some(value) = stream.next().await {
|
||||||
@@ -46,10 +46,10 @@ pin_project! {
|
|||||||
/// ```rust
|
/// ```rust
|
||||||
/// use axum::{BoxError, response::{IntoResponse, Response}};
|
/// use axum::{BoxError, response::{IntoResponse, Response}};
|
||||||
/// use axum_extra::json_lines::JsonLines;
|
/// use axum_extra::json_lines::JsonLines;
|
||||||
/// use futures::stream::Stream;
|
/// use futures_util::stream::Stream;
|
||||||
///
|
///
|
||||||
/// fn stream_of_values() -> impl Stream<Item = Result<serde_json::Value, BoxError>> {
|
/// fn stream_of_values() -> impl Stream<Item = Result<serde_json::Value, BoxError>> {
|
||||||
/// # futures::stream::empty()
|
/// # futures_util::stream::empty()
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// async fn handler() -> Response {
|
/// async fn handler() -> Response {
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
- None.
|
- **change:** Update to syn 2.0 ([#1862])
|
||||||
|
|
||||||
|
[#1862]: https://github.com/tokio-rs/axum/pull/1862
|
||||||
|
|
||||||
# 0.3.6 (13. March, 2023)
|
# 0.3.6 (13. March, 2023)
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,9 @@ proc-macro = true
|
|||||||
heck = "0.4"
|
heck = "0.4"
|
||||||
proc-macro2 = "1.0"
|
proc-macro2 = "1.0"
|
||||||
quote = "1.0"
|
quote = "1.0"
|
||||||
syn = { version = "1.0", features = [
|
syn = { version = "2.0", features = [
|
||||||
"full",
|
"full",
|
||||||
|
"parsing",
|
||||||
# needed for `Hash` impls
|
# needed for `Hash` impls
|
||||||
"extra-traits",
|
"extra-traits",
|
||||||
] }
|
] }
|
||||||
@@ -34,7 +35,7 @@ axum-extra = { path = "../axum-extra", version = "0.7.0", features = ["typed-rou
|
|||||||
rustversion = "1.0"
|
rustversion = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
syn = { version = "1.0", features = ["full", "extra-traits"] }
|
syn = { version = "2.0", features = ["full", "extra-traits"] }
|
||||||
tokio = { version = "1.25.0", features = ["full"] }
|
tokio = { version = "1.25.0", features = ["full"] }
|
||||||
trybuild = "1.0.63"
|
trybuild = "1.0.63"
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ where
|
|||||||
{
|
{
|
||||||
attrs
|
attrs
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|attr| attr.path.is_ident(ident))
|
.filter(|attr| attr.meta.path().is_ident(ident))
|
||||||
.map(|attr| attr.parse_args::<T>())
|
.map(|attr| attr.parse_args::<T>())
|
||||||
.try_fold(T::default(), |out, next| out.combine(next?))
|
.try_fold(T::default(), |out, next| out.combine(next?))
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -30,7 +30,7 @@ ws = ["tokio", "dep:tokio-tungstenite", "dep:sha1", "dep:base64"]
|
|||||||
__private_docs = ["tower/full", "dep:tower-http"]
|
__private_docs = ["tower/full", "dep:tower-http"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1.43"
|
async-trait = "0.1.67"
|
||||||
axum-core = { path = "../axum-core", version = "0.3.3" }
|
axum-core = { path = "../axum-core", version = "0.3.3" }
|
||||||
bitflags = "1.0"
|
bitflags = "1.0"
|
||||||
bytes = "1.0"
|
bytes = "1.0"
|
||||||
@@ -103,7 +103,6 @@ rustversion = "1.0.9"
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
axum-macros = { path = "../axum-macros", version = "0.3.4", features = ["__private"] }
|
axum-macros = { path = "../axum-macros", version = "0.3.4", features = ["__private"] }
|
||||||
futures = "0.3"
|
|
||||||
quickcheck = "1.0"
|
quickcheck = "1.0"
|
||||||
quickcheck_macros = "1.0"
|
quickcheck_macros = "1.0"
|
||||||
reqwest = { version = "0.11.14", default-features = false, features = ["json", "stream", "multipart"] }
|
reqwest = { version = "0.11.14", default-features = false, features = ["json", "stream", "multipart"] }
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ pin_project! {
|
|||||||
/// body::StreamBody,
|
/// body::StreamBody,
|
||||||
/// response::IntoResponse,
|
/// response::IntoResponse,
|
||||||
/// };
|
/// };
|
||||||
/// use futures::stream::{self, Stream};
|
/// use futures_util::stream::{self, Stream};
|
||||||
/// use std::io;
|
/// use std::io;
|
||||||
///
|
///
|
||||||
/// async fn handler() -> StreamBody<impl Stream<Item = io::Result<&'static str>>> {
|
/// async fn handler() -> StreamBody<impl Stream<Item = io::Result<&'static str>>> {
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ use axum::{
|
|||||||
body::Body,
|
body::Body,
|
||||||
http::Request,
|
http::Request,
|
||||||
};
|
};
|
||||||
use futures::future::BoxFuture;
|
use futures_util::future::BoxFuture;
|
||||||
use tower::{Service, Layer};
|
use tower::{Service, Layer};
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ use std::{
|
|||||||
/// routing::post,
|
/// routing::post,
|
||||||
/// Router,
|
/// Router,
|
||||||
/// };
|
/// };
|
||||||
/// use futures::stream::StreamExt;
|
/// use futures_util::stream::StreamExt;
|
||||||
///
|
///
|
||||||
/// async fn upload(mut multipart: Multipart) {
|
/// async fn upload(mut multipart: Multipart) {
|
||||||
/// while let Some(mut field) = multipart.next_field().await.unwrap() {
|
/// while let Some(mut field) = multipart.next_field().await.unwrap() {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use std::convert::Infallible;
|
|||||||
/// routing::get,
|
/// routing::get,
|
||||||
/// Router,
|
/// Router,
|
||||||
/// };
|
/// };
|
||||||
/// use futures::StreamExt;
|
/// use futures_util::StreamExt;
|
||||||
///
|
///
|
||||||
/// async fn handler(RawQuery(query): RawQuery) {
|
/// async fn handler(RawQuery(query): RawQuery) {
|
||||||
/// // ...
|
/// // ...
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ where
|
|||||||
/// routing::get,
|
/// routing::get,
|
||||||
/// Router,
|
/// Router,
|
||||||
/// };
|
/// };
|
||||||
/// use futures::StreamExt;
|
/// use futures_util::StreamExt;
|
||||||
///
|
///
|
||||||
/// async fn handler(mut stream: BodyStream) {
|
/// async fn handler(mut stream: BodyStream) {
|
||||||
/// while let Some(chunk) = stream.next().await {
|
/// while let Some(chunk) = stream.next().await {
|
||||||
@@ -192,7 +192,7 @@ fn body_stream_traits() {
|
|||||||
/// routing::get,
|
/// routing::get,
|
||||||
/// Router,
|
/// Router,
|
||||||
/// };
|
/// };
|
||||||
/// use futures::StreamExt;
|
/// use futures_util::StreamExt;
|
||||||
///
|
///
|
||||||
/// async fn handler(RawBody(body): RawBody) {
|
/// async fn handler(RawBody(body): RawBody) {
|
||||||
/// // ...
|
/// // ...
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ```rust,no_run
|
//! ```rust,no_run
|
||||||
//! use axum::{Error, extract::ws::{WebSocket, Message}};
|
//! use axum::{Error, extract::ws::{WebSocket, Message}};
|
||||||
//! use futures::{sink::SinkExt, stream::{StreamExt, SplitSink, SplitStream}};
|
//! use futures_util::{sink::SinkExt, stream::{StreamExt, SplitSink, SplitStream}};
|
||||||
//!
|
//!
|
||||||
//! async fn handle_socket(mut socket: WebSocket) {
|
//! async fn handle_socket(mut socket: WebSocket) {
|
||||||
//! let (mut sender, mut receiver) = socket.split();
|
//! let (mut sender, mut receiver) = socket.split();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
//! };
|
//! };
|
||||||
//! use std::{time::Duration, convert::Infallible};
|
//! use std::{time::Duration, convert::Infallible};
|
||||||
//! use tokio_stream::StreamExt as _ ;
|
//! use tokio_stream::StreamExt as _ ;
|
||||||
//! use futures::stream::{self, Stream};
|
//! use futures_util::stream::{self, Stream};
|
||||||
//!
|
//!
|
||||||
//! let app = Router::new().route("/sse", get(sse_handler));
|
//! let app = Router::new().route("/sse", get(sse_handler));
|
||||||
//!
|
//!
|
||||||
@@ -509,7 +509,7 @@ impl<'a> Iterator for MemchrSplit<'a> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{routing::get, test_helpers::*, Router};
|
use crate::{routing::get, test_helpers::*, Router};
|
||||||
use futures::stream;
|
use futures_util::stream;
|
||||||
use std::{collections::HashMap, convert::Infallible};
|
use std::{collections::HashMap, convert::Infallible};
|
||||||
use tokio_stream::StreamExt as _;
|
use tokio_stream::StreamExt as _;
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ async fn layer() {
|
|||||||
async fn layer_and_handle_error() {
|
async fn layer_and_handle_error() {
|
||||||
let one = Router::new().route("/foo", get(|| async {}));
|
let one = Router::new().route("/foo", get(|| async {}));
|
||||||
let two = Router::new()
|
let two = Router::new()
|
||||||
.route("/timeout", get(futures::future::pending::<()>))
|
.route("/timeout", get(std::future::pending::<()>))
|
||||||
.layer(
|
.layer(
|
||||||
ServiceBuilder::new()
|
ServiceBuilder::new()
|
||||||
.layer(HandleErrorLayer::new(|_| async {
|
.layer(HandleErrorLayer::new(|_| async {
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ skip-tree = [
|
|||||||
{ name = "windows-sys" },
|
{ name = "windows-sys" },
|
||||||
# old version pulled in by rustls via ring
|
# old version pulled in by rustls via ring
|
||||||
{ name = "spin" },
|
{ name = "spin" },
|
||||||
|
# lots still pulls in syn 1.x
|
||||||
|
{ name = "syn" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[sources]
|
[sources]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ publish = false
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
axum = { path = "../../axum" }
|
axum = { path = "../../axum" }
|
||||||
futures-util = "0.3"
|
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
|
||||||
hyper = { version = "0.14", features = ["full"] }
|
hyper = { version = "0.14", features = ["full"] }
|
||||||
openssl = "0.10"
|
openssl = "0.10"
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ publish = false
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
axum = { path = "../../axum" }
|
axum = { path = "../../axum" }
|
||||||
futures-util = "0.3"
|
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
|
||||||
hyper = { version = "0.14", features = ["full"] }
|
hyper = { version = "0.14", features = ["full"] }
|
||||||
rustls-pemfile = "0.3"
|
rustls-pemfile = "0.3"
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ publish = false
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1"
|
async-trait = "0.1.67"
|
||||||
axum = { path = "../../axum" }
|
axum = { path = "../../axum" }
|
||||||
http-body = "0.4.3"
|
http-body = "0.4.3"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
|||||||
Reference in New Issue
Block a user