diff --git a/tower/src/retry/mod.rs b/tower/src/retry/mod.rs index e369dbb..bbbc64e 100644 --- a/tower/src/retry/mod.rs +++ b/tower/src/retry/mod.rs @@ -31,6 +31,21 @@ impl Retry { pub fn new(policy: P, service: S) -> Self { Retry { policy, service } } + + /// Get a reference to the inner service + pub fn get_ref(&self) -> &S { + &self.service + } + + /// Get a mutable reference to the inner service + pub fn get_mut(&mut self) -> &mut S { + &mut self.service + } + + /// Consume `self`, returning the inner service + pub fn into_inner(self) -> S { + self.service + } } impl Service for Retry diff --git a/tower/src/timeout/mod.rs b/tower/src/timeout/mod.rs index 1a3e04b..ac5ae93 100644 --- a/tower/src/timeout/mod.rs +++ b/tower/src/timeout/mod.rs @@ -28,6 +28,21 @@ impl Timeout { pub fn new(inner: T, timeout: Duration) -> Self { Timeout { inner, timeout } } + + /// Get a reference to the inner service + pub fn get_ref(&self) -> &T { + &self.inner + } + + /// Get a mutable reference to the inner service + pub fn get_mut(&mut self) -> &mut T { + &mut self.inner + } + + /// Consume `self`, returning the inner service + pub fn into_inner(self) -> T { + self.inner + } } impl Service for Timeout