From 8cdfa445d6629ffef4cb84967ff7017654045bc2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 2 Jul 2025 18:36:06 -0600 Subject: chore: add vendor directory --- vendor/tower/src/timeout/layer.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 vendor/tower/src/timeout/layer.rs (limited to 'vendor/tower/src/timeout/layer.rs') diff --git a/vendor/tower/src/timeout/layer.rs b/vendor/tower/src/timeout/layer.rs new file mode 100644 index 00000000..d8cc2d1c --- /dev/null +++ b/vendor/tower/src/timeout/layer.rs @@ -0,0 +1,24 @@ +use super::Timeout; +use std::time::Duration; +use tower_layer::Layer; + +/// Applies a timeout to requests via the supplied inner service. +#[derive(Debug, Clone)] +pub struct TimeoutLayer { + timeout: Duration, +} + +impl TimeoutLayer { + /// Create a timeout from a duration + pub const fn new(timeout: Duration) -> Self { + TimeoutLayer { timeout } + } +} + +impl Layer for TimeoutLayer { + type Service = Timeout; + + fn layer(&self, service: S) -> Self::Service { + Timeout::new(service, self.timeout) + } +} -- cgit v1.2.3