pub struct Router<S = ()> { /* private fields */ }Expand description
Axum-like routing table using matchit under the hood.
Implementations§
Source§impl<S> Router<S>
impl<S> Router<S>
Sourcepub const fn normalize_trailing_slash(self) -> Self
pub const fn normalize_trailing_slash(self) -> Self
Opt in to trailing-slash normalization: strips a single trailing /
from the incoming request’s path before routing, so /foo and
/foo/ reach the same route.
By default (matching Axum) routing is strict — /foo and /foo/ are
distinct routes, and a mismatch 404s. This opts into the common
convenience behavior natively, without pulling in tower/tower-http
just for tower_http::normalize_path::NormalizePathLayer — this method
mirrors that layer’s own semantics exactly (an in-place path
normalization applied once per request, not a redirect), just built in.
Only meaningful on the outermost Router you actually .compile() (or
hand to a Server) — like NormalizePathLayer, it operates on the
whole incoming request before any route matching happens, so setting it
on a router later merged/nested into another has no effect.
Sourcepub fn no_index(self) -> Self
pub fn no_index(self) -> Self
Opt out of search-engine indexing — appropriate default hardening for .onion/.i2p
deployments, where a crawlable mirror is itself an unintentional discovery/deanonymization
leak (some operators don’t realize search engines index onion mirrors at all).
Adds X-Robots-Tag: noindex, nofollow to every response from this router (routes and
fallback alike), and — unless the app already registers its own /robots.txt route —
serves a blanket User-agent: *\nDisallow: / there too.
§Example
use tachyon_web::{Router, get};
let router: Router = Router::new()
.route("/", get(|| async { "hi" }))
.no_index();Sourcepub fn with_state<S2>(self, state: S) -> Router<S2>
pub fn with_state<S2>(self, state: S) -> Router<S2>
Set the application state for this router, transitioning it to
another (typically ()) state type — matching Axum’s
Router<S>::with_state<S2>(self, state: S) -> Router<S2> signature.
S2 is almost always inferred as () since a fully-stated router is
normally handed straight to a Server, but leaving it generic (rather
than hardcoding Router<()>) matches Axum’s nested-router pattern,
where an inner router’s state is supplied by an outer router before
the two are merged/nested and the outer router still has its own,
different state type to resolve later.
Sourcepub fn route(self, path: &str, method_router: MethodRouter<S>) -> Self
pub fn route(self, path: &str, method_router: MethodRouter<S>) -> Self
Add a route to the router.
Registering the same path more than once merges the method routers —
e.g. .route("/x", get(a)).route("/x", post(b)) yields one route that
answers both GET and POST — matching Axum. Registering the same
method for the same path twice panics, also matching Axum.
Sourcepub const fn into_make_service(self) -> Self
pub const fn into_make_service(self) -> Self
A dummy/compatibility method that returns the router itself, matching Axum’s API when preparing a router to be run with a server listener.
Sourcepub fn serve_static(self, dir_path: impl AsRef<Path>) -> Self
pub fn serve_static(self, dir_path: impl AsRef<Path>) -> Self
Serve an entire directory as static files — the simplest, Nginx-like API.
Serves directly from disk on every request; it does not call
static_dir::ServeDir::preload, so CacheConfig::enabled’s default of
true has no effect here. Use serve_dir with a
manually-preloaded ServeDir if you want the in-memory RAM cache.
Do not point dir_path at a directory that can ever contain files an
untrusted user chose the bytes of (e.g. an upload folder mixed into the
served tree) — see static_dir::ServeDir’s docs for why (in short: a
user-supplied .svg served this way can carry an executable
<script>).
§Example
use tachyon_web::Router;
// Serve ./public/ at /, with index.html as the default.
let router = Router::new()
.serve_static("./public");Sourcepub fn serve_dir(self, prefix: &str, serve_dir: ServeDir) -> Self
pub fn serve_dir(self, prefix: &str, serve_dir: ServeDir) -> Self
Serve an entire static directory under a URL prefix with full configuration control.
Registers both an exact route (prefix) and a wildcard route (prefix/*path).
Use serve_static() for the common case of serving a dir at /. See
static_dir::ServeDir’s docs for the upload-safety warning before
serving a directory that can contain user-supplied files.
Sourcepub fn serve_file(self, path: &str, file_path: &str) -> Result<Self, Error>
pub fn serve_file(self, path: &str, file_path: &str) -> Result<Self, Error>
Natively serve a specific file on a specific route.
The file is read once at startup into a Bytes buffer. Every subsequent
request is served from that buffer with zero I/O and zero allocations,
rivalling include_bytes! without inflating the binary.
§Errors
Returns an Err if the file cannot be read at startup.
Sourcepub fn serve_file_dynamic(self, path: &str, file_path: &str) -> Self
pub fn serve_file_dynamic(self, path: &str, file_path: &str) -> Self
Natively serve a specific file on a specific route dynamically.
The file is read from disk on every request. Ideal for large files that change frequently where startup preloading is undesirable.
Sourcepub fn nest(self, prefix: &str, router: Self) -> Self
pub fn nest(self, prefix: &str, router: Self) -> Self
Nest another router under a given path prefix.
Seamlessly merges all routes from the sub-router into this router.
Matches Axum: handlers inside the nested router see a request Uri with
prefix stripped (e.g. a request to /api/users/1 nested under /api
sees /users/1), while crate::routing::extract::OriginalUri recovers
the pre-strip, full path. Nesting is resolved once at compile() time —
there’s no per-request recursive dispatch — so this is exactly as fast as
a flat route table; only the one matched route’s prefix is ever stripped.
§Deviation from Axum: the inner router’s own fallback is not carried over
In real Axum, nesting mounts the whole inner Router as a recursive sub-service, so a
request under prefix that the inner router’s own routes don’t match still reaches the
inner router’s fallback before ever falling through to the outer one. Because this
implementation flattens the inner router’s routes into the same top-level route table
(the design that keeps nesting as fast as a flat lookup — see above), there is no
separate inner dispatch step left for a per-nest fallback to hook into: any path under
prefix that isn’t one of the inner router’s own registered routes simply falls through
to whatever Router::fallback (or the default 404) is configured on the outermost
router — the inner router’s own .fallback(...), if it set one, is never called. Use
Router::fallback on the outer router (or register an explicit catch-all route under
prefix) if you need a per-module 404 handler.
Sourcepub fn merge(self, other: Self) -> Self
pub fn merge(self, other: Self) -> Self
Merge another router’s routes into this router.
If exactly one of the two routers has a fallback (or a
method_not_allowed_fallback) configured, the
merged router adopts it — matching Axum, which does the same for Router::fallback.
Unlike nest (where the inner router’s fallback is deliberately never
reachable — it would only ever fire for a request the outer router’s own routing
already decided was unmatched, which the outer fallback already handles), merge
treats both routers as peers, so silently dropping one side’s fallback would silently
change which handler answers unmatched requests.
§Panics
Panics if other defines a method for a path already registered in self, or if
both routers already have a fallback/method_not_allowed_fallback configured —
matching Axum’s Router::merge.
Sourcepub fn route_service<Svc, RespBody>(self, path: &str, service: Svc) -> Self
pub fn route_service<Svc, RespBody>(self, path: &str, service: Svc) -> Self
Mount a raw tower::Service at path, handling every HTTP method.
Requires the tower feature. Prefer .route(path, get(handler)) with a native
handler where possible — this exists to bridge in pre-built Tower/tower-http
services (e.g. tower_http::services::ServeFile) without a rewrite.
Sourcepub fn nest_service<Svc, RespBody>(self, prefix: &str, service: Svc) -> Self
pub fn nest_service<Svc, RespBody>(self, prefix: &str, service: Svc) -> Self
Nest a raw tower::Service under prefix, with the mounted path rewritten
relative to prefix before the service sees it (matching Axum’s nest_service).
Requires the tower feature.
Sourcepub fn fallback_service<Svc, RespBody>(self, service: Svc) -> Self
pub fn fallback_service<Svc, RespBody>(self, service: Svc) -> Self
Set a raw tower::Service as the fallback for unmatched paths.
Requires the tower feature.
Sourcepub fn layer<L, RespBody>(self, layer: L) -> Selfwhere
L: Layer<NextService<S>> + Clone + Send + Sync + 'static,
L::Service: Service<Request<Bytes>, Response = Response<RespBody>> + Send + 'static,
<L::Service as Service<Request<Bytes>>>::Future: Send + 'static,
<L::Service as Service<Request<Bytes>>>::Error: Into<Error> + Send,
RespBody: Body<Data = Bytes> + Send + 'static,
RespBody::Error: Into<Error>,
pub fn layer<L, RespBody>(self, layer: L) -> Selfwhere
L: Layer<NextService<S>> + Clone + Send + Sync + 'static,
L::Service: Service<Request<Bytes>, Response = Response<RespBody>> + Send + 'static,
<L::Service as Service<Request<Bytes>>>::Future: Send + 'static,
<L::Service as Service<Request<Bytes>>>::Error: Into<Error> + Send,
RespBody: Body<Data = Bytes> + Send + 'static,
RespBody::Error: Into<Error>,
Apply a tower::Layer to every route and the fallback in this router.
Requires the tower feature. Prefer .hoop()/.hoop_at() for new code — this
exists to bridge in existing Tower/tower-http layers (tracing, compression,
timeouts) without rewriting them as native middleware.
Sourcepub fn route_layer<L, RespBody>(self, layer: L) -> Selfwhere
L: Layer<NextService<S>> + Clone + Send + Sync + 'static,
L::Service: Service<Request<Bytes>, Response = Response<RespBody>> + Send + 'static,
<L::Service as Service<Request<Bytes>>>::Future: Send + 'static,
<L::Service as Service<Request<Bytes>>>::Error: Into<Error> + Send,
RespBody: Body<Data = Bytes> + Send + 'static,
RespBody::Error: Into<Error>,
pub fn route_layer<L, RespBody>(self, layer: L) -> Selfwhere
L: Layer<NextService<S>> + Clone + Send + Sync + 'static,
L::Service: Service<Request<Bytes>, Response = Response<RespBody>> + Send + 'static,
<L::Service as Service<Request<Bytes>>>::Future: Send + 'static,
<L::Service as Service<Request<Bytes>>>::Error: Into<Error> + Send,
RespBody: Body<Data = Bytes> + Send + 'static,
RespBody::Error: Into<Error>,
Apply a tower::Layer to every registered route, but not the fallback —
matching Axum’s distinction between .layer() and .route_layer().
Requires the tower feature.
Sourcepub fn fallback<H, T>(self, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn fallback<H, T>(self, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Set a custom fallback handler for requests that don’t match any route.
Sourcepub fn method_not_allowed_fallback<H, T>(self, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn method_not_allowed_fallback<H, T>(self, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Set a custom fallback handler for requests whose path matches a route but
whose method has no registered handler (the default is a bare 405 Method Not Allowed with an Allow header).
Sourcepub fn hoop<F, Fut, Res>(self, middleware: F) -> Self
pub fn hoop<F, Fut, Res>(self, middleware: F) -> Self
Apply a middleware handler to ALL routes and the fallback registered in this Router.
Sourcepub fn hoop_at<F, Fut, Res>(
self,
position: MiddlewarePosition,
middleware: F,
) -> Self
pub fn hoop_at<F, Fut, Res>( self, position: MiddlewarePosition, middleware: F, ) -> Self
Apply a middleware handler at a specific position (First/Last) to ALL routes and the fallback.
Sourcepub async fn handle_request(&self, req: Request<Body>) -> Response<Body>where
S: Default,
pub async fn handle_request(&self, req: Request<Body>) -> Response<Body>where
S: Default,
Route an incoming request directly, compiling the router on the fly. Primarily useful for testing.
§Panics
Panics if router compilation fails (e.g. a duplicate route was registered).
Sourcepub fn compile(self) -> Result<CompiledRouter<S>, RouterError>where
S: Default,
pub fn compile(self) -> Result<CompiledRouter<S>, RouterError>where
S: Default,
Build and compile the routing tree, returning a CompiledRouter.
§Errors
Returns RouterError::DuplicateRoute if the same literal path somehow
reaches compile() twice. In practice this can’t happen through the
public API — route()/nest()/merge() all merge same-path entries
(panicking on overlapping methods, matching Axum) — this is an
internal invariant check, not a condition callers need to handle.
Trait Implementations§
Source§impl<B> Service<Request<B>> for Router<()>
Lets an uncompiled, stateless crate::routing::Router be driven
directly as a tower::Service — e.g. Router::new().route(...).oneshot(req)
— with no separate .compile() call, matching axum::Router’s drop-in
ergonomics exactly: build with .route()/.nest()/.merge()/.hoop()/
etc., then hand the same value straight to .oneshot(), a tower
server, or anything else expecting a Service.
impl<B> Service<Request<B>> for Router<()>
Lets an uncompiled, stateless crate::routing::Router be driven
directly as a tower::Service — e.g. Router::new().route(...).oneshot(req)
— with no separate .compile() call, matching axum::Router’s drop-in
ergonomics exactly: build with .route()/.nest()/.merge()/.hoop()/
etc., then hand the same value straight to .oneshot(), a tower
server, or anything else expecting a Service.
Internally this compiles the matchit route tree once, the first
time call() runs, and caches the result in Router’s private
compiled field — every builder method that mutates the route table
resets that cache, so it’s impossible to silently dispatch against a
stale tree. Every call after the first is exactly as cheap as calling
the already-CompiledRouter directly; the split from axum::Router
(which has no separate compiled form at all) is now purely internal.
Deliberately restricted to Router<()>, matching Axum exactly (Axum only
implements Service for Router<()> too — a Router<S> for S != ()
hasn’t been given its state yet, so there’s nothing meaningful to serve).
This is what makes plain Router::new().route(...).oneshot(req) type-check
with no turbofish: Service has exactly one impl to unify against, same
as in Axum. A router built with real shared state (State<T> extractors)
still needs .with_state(actual_state) first, same as Axum — at that
point it’s already a Router<()> too. For testing a still-generic
Router<S>/CompiledRouter<S> for S != () directly, use
CompiledRouter’s broader impl above
via an explicit .compile().
use tachyon_web::{Router, get};
use tower::ServiceExt;
async fn handler() -> &'static str { "hi" }
let app = Router::new().route("/", get(handler));
let req = hyper::Request::builder().uri("/").body(http_body_util::Full::new(bytes::Bytes::new()))?;
let resp = app.oneshot(req).await?;Source§type Error = Infallible
type Error = Infallible
Source§type Future = Pin<Box<dyn Future<Output = Result<<Router as Service<Request<B>>>::Response, <Router as Service<Request<B>>>::Error>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<<Router as Service<Request<B>>>::Response, <Router as Service<Request<B>>>::Error>> + Send>>
Auto Trait Implementations§
impl<S = ()> !Freeze for Router<S>
impl<S = ()> !RefUnwindSafe for Router<S>
impl<S = ()> !UnwindSafe for Router<S>
impl<S> Send for Router<S>
impl<S> Sync for Router<S>
impl<S> Unpin for Router<S>
impl<S> UnsafeUnpin for Router<S>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PossiblyOption<T> for T
impl<T> PossiblyOption<T> for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
Source§fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
Source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
Source§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
Service, calling it with the provided request once it is ready.Source§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
poll_ready method. Read moreSource§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
poll_ready method. Read moreSource§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
poll_ready method. Read moreSource§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Result<Self::Response, Self::Error>)
to a different value, regardless of whether the future succeeds or
fails. Read moreSource§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
Source§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
Source§fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.