mirror of
https://github.com/Noratrieb/101844-repro.git
synced 2026-01-14 14:25:02 +01:00
features
This commit is contained in:
parent
64cabb2240
commit
136f1b4bd9
7 changed files with 56 additions and 168 deletions
83
Cargo.lock
generated
83
Cargo.lock
generated
|
|
@ -15,6 +15,12 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
|
|
@ -27,6 +33,12 @@ version = "0.3.24"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.24"
|
||||
|
|
@ -56,34 +68,12 @@ dependencies = [
|
|||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.132"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.9"
|
||||
|
|
@ -151,38 +141,41 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-stream"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df54d54117d6fdc4e4fea40fe1e4e566b3505700e148a6827e59b34b0d2600d9"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"indexmap",
|
||||
"pin-project-lite",
|
||||
"rand",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"pin-project-lite",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"tokio-stream",
|
||||
"tokio-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
tower = { path = "./tower/tower", default-features = false, features = ["balance"] }
|
||||
tower = { path = "./tower/tower" }
|
||||
|
|
@ -1,104 +1,18 @@
|
|||
[package]
|
||||
name = "tower"
|
||||
# When releasing to crates.io:
|
||||
# - Update doc url
|
||||
# - Cargo.toml
|
||||
# - README.md
|
||||
# - Update CHANGELOG.md.
|
||||
# - Create "vX.X.X" git tag.
|
||||
version = "0.4.13"
|
||||
authors = ["Tower Maintainers <team@tower-rs.com>"]
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/tower-rs/tower"
|
||||
homepage = "https://github.com/tower-rs/tower"
|
||||
documentation = "https://docs.rs/tower/0.4.13"
|
||||
description = """
|
||||
Tower is a library of modular and reusable components for building robust
|
||||
clients and servers.
|
||||
"""
|
||||
categories = ["asynchronous", "network-programming"]
|
||||
keywords = ["io", "async", "non-blocking", "futures", "service"]
|
||||
edition = "2018"
|
||||
rust-version = "1.49.0"
|
||||
|
||||
[features]
|
||||
default = ["log"]
|
||||
|
||||
# Internal
|
||||
__common = ["futures-core", "pin-project-lite"]
|
||||
|
||||
full = [
|
||||
"balance",
|
||||
"buffer",
|
||||
"discover",
|
||||
"filter",
|
||||
"hedge",
|
||||
"limit",
|
||||
"load",
|
||||
"load-shed",
|
||||
"make",
|
||||
"ready-cache",
|
||||
"reconnect",
|
||||
"retry",
|
||||
"spawn-ready",
|
||||
"steer",
|
||||
"timeout",
|
||||
"util",
|
||||
]
|
||||
# FIXME: Use weak dependency once available (https://github.com/rust-lang/cargo/issues/8832)
|
||||
log = ["tracing/log"]
|
||||
balance = ["discover", "load", "ready-cache", "make", "rand", "slab"]
|
||||
buffer = ["__common", "tokio/sync", "tokio/rt", "tokio-util", "tracing"]
|
||||
discover = ["__common"]
|
||||
filter = ["__common", "futures-util"]
|
||||
hedge = ["util", "filter", "futures-util", "hdrhistogram", "tokio/time", "tracing"]
|
||||
limit = ["__common", "tokio/time", "tokio/sync", "tokio-util", "tracing"]
|
||||
load = ["__common", "tokio/time", "tracing"]
|
||||
load-shed = ["__common"]
|
||||
make = ["futures-util", "pin-project-lite", "tokio/io-std"]
|
||||
ready-cache = ["futures-core", "futures-util", "indexmap", "tokio/sync", "tracing", "pin-project-lite"]
|
||||
reconnect = ["make", "tokio/io-std", "tracing"]
|
||||
retry = ["__common", "tokio/time"]
|
||||
spawn-ready = ["__common", "futures-util", "tokio/sync", "tokio/rt", "util", "tracing"]
|
||||
steer = []
|
||||
timeout = ["pin-project-lite", "tokio/time"]
|
||||
util = ["__common", "futures-util", "pin-project"]
|
||||
|
||||
[dependencies]
|
||||
futures-core = { version = "0.3", optional = true }
|
||||
futures-util = { version = "0.3", default-features = false, features = ["alloc"], optional = true }
|
||||
hdrhistogram = { version = "7.0", optional = true, default-features = false }
|
||||
indexmap = { version = "1.0.2", optional = true }
|
||||
rand = { version = "0.8", features = ["small_rng"], optional = true }
|
||||
slab = { version = "0.4", optional = true }
|
||||
tokio = { version = "1.6", optional = true, features = ["sync"] }
|
||||
tokio-stream = { version = "0.1.0", optional = true }
|
||||
tokio-util = { version = "0.7.0", default-features = false, optional = true }
|
||||
tracing = { version = "0.1.2", default-features = false, features = ["std"], optional = true }
|
||||
pin-project = { version = "1", optional = true }
|
||||
pin-project-lite = { version = "0.2.7", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
futures = "0.3"
|
||||
hdrhistogram = { version = "7.0", default-features = false }
|
||||
pin-project-lite = "0.2.7"
|
||||
tokio = { version = "1.6.2", features = ["macros", "sync", "test-util", "rt-multi-thread"] }
|
||||
tokio-stream = "0.1"
|
||||
tokio-test = "0.4"
|
||||
tower-test = { version = "0.4", path = "../tower-test" }
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "ansi"] }
|
||||
http = "0.2"
|
||||
lazy_static = "1.4.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
features = ["full"]
|
||||
|
||||
[[example]]
|
||||
name = "tower-balance"
|
||||
path = "examples/tower-balance.rs"
|
||||
required-features = ["full"]
|
||||
futures-core = { version = "0.3" }
|
||||
futures-util = { version = "0.3", default-features = false, features = [
|
||||
"alloc",
|
||||
] }
|
||||
rand = { version = "0.8", features = ["small_rng"] }
|
||||
slab = { version = "0.4" }
|
||||
tokio = { version = "1.6", features = ["sync", "time"] }
|
||||
tokio-stream = { version = "0.1.0" }
|
||||
tokio-util = { version = "0.7.0", default-features = false }
|
||||
|
|
|
|||
|
|
@ -1,23 +1,15 @@
|
|||
use crate::discover::{Change, Discover};
|
||||
use crate::load::Load;
|
||||
use crate::make::MakeService;
|
||||
use futures_core::ready;
|
||||
use crate::Service;
|
||||
use futures_core::Stream;
|
||||
use futures_util::future::{self, TryFutureExt};
|
||||
use pin_project_lite::pin_project;
|
||||
use rand::{rngs::SmallRng, Rng, SeedableRng};
|
||||
use slab::Slab;
|
||||
use futures_util::future::{self};
|
||||
use std::hash::Hash;
|
||||
use std::marker::PhantomData;
|
||||
use std::{
|
||||
fmt,
|
||||
future::Future,
|
||||
pin::Pin,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
use tokio::sync::oneshot;
|
||||
use crate::Service;
|
||||
use tracing::{debug, trace};
|
||||
|
||||
pub struct Balance<D, Req> {
|
||||
_req: PhantomData<(D, Req)>,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(warnings)]
|
||||
// #![allow(warnings)]
|
||||
|
||||
#[macro_use]
|
||||
pub(crate) mod macros;
|
||||
|
|
|
|||
|
|
@ -1,19 +1,11 @@
|
|||
#[cfg(any(
|
||||
feature = "util",
|
||||
feature = "spawn-ready",
|
||||
feature = "filter",
|
||||
feature = "make"
|
||||
))]
|
||||
macro_rules! opaque_future {
|
||||
($(#[$m:meta])* pub type $name:ident<$($param:ident),+> = $actual:ty;) => {
|
||||
pin_project_lite::pin_project! {
|
||||
$(#[$m])*
|
||||
pub struct $name<$($param),+> {
|
||||
#[pin]
|
||||
inner: $actual
|
||||
}
|
||||
$(#[$m])*
|
||||
pub struct $name<$($param),+> {
|
||||
inner: $actual
|
||||
}
|
||||
|
||||
|
||||
impl<$($param),+> $name<$($param),+> {
|
||||
pub(crate) fn new(inner: $actual) -> Self {
|
||||
Self {
|
||||
|
|
@ -35,7 +27,7 @@ macro_rules! opaque_future {
|
|||
type Output = <$actual as std::future::Future>::Output;
|
||||
#[inline]
|
||||
fn poll(self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> std::task::Poll<Self::Output> {
|
||||
self.project().inner.poll(cx)
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@ mod make_service {
|
|||
//! Contains [`MakeService`] which is a trait alias for a [`Service`] of [`Service`]s.
|
||||
|
||||
use crate::sealed::Sealed;
|
||||
use std::fmt;
|
||||
use std::future::Future;
|
||||
use std::marker::PhantomData;
|
||||
use std::task::{Context, Poll};
|
||||
use crate::Service;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue