pub struct PortRouter {
pub listeners: Arc<RwLock<Arc<Vec<ListenerConfig>>>>,
/* private fields */
}Available on crate feature
gateway-api only.Fields§
§listeners: Arc<RwLock<Arc<Vec<ListenerConfig>>>>Implementations§
Source§impl PortRouter
impl PortRouter
pub fn new(listeners: Arc<RwLock<Arc<Vec<ListenerConfig>>>>) -> PortRouter
Trait Implementations§
Source§impl Application for PortRouter
impl Application for PortRouter
Source§fn execute_async<'a>(
&'a self,
request: &'a Request,
connection: &'a ConnectionInfo,
) -> Option<Pin<Box<dyn Future<Output = Result<Response, String>> + Send + 'a>>>
Available on crate feature http2 only.
fn execute_async<'a>( &'a self, request: &'a Request, connection: &'a ConnectionInfo, ) -> Option<Pin<Box<dyn Future<Output = Result<Response, String>> + Send + 'a>>>
http2 only.Everything but upgrades runs here, on the connection’s task: the forwarding loop waits on tokio sockets instead of holding a blocking-pool thread per request in flight.
Source§fn execute(
&self,
request: &Request,
connection: &ConnectionInfo,
) -> Result<Response, String>
fn execute( &self, request: &Request, connection: &ConnectionInfo, ) -> Result<Response, String>
Receives a parsed request and returns a fully-built response.
Walk your controller list with
is_matching / process and return the first match.Source§fn runs_inline(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
fn runs_inline(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
true when executing request is quick and never waits on anything
but the local filesystem — health checks, metrics, small static files.
The async servers (HTTP/1.1, HTTP/2, HTTP/3) then call execute
directly on the event loop, as nginx does, instead of handing the
request to tokio’s blocking pool: that handoff (a shared lock and two
cross-thread wake-ups) costs more than serving a small file. Read moreSource§fn streams_body(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
fn streams_body(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
true to receive this request’s body as a stream (Body::Stream)
instead of read into memory first: execute then runs while the
body is still arriving, on a blocking-pool thread, and reads it with
std::io::Read — a multi-gigabyte upload in a few chunks of memory.
Asked after the head is read, so request.body is empty here;
decide from the method, path and headers. Read moreSource§fn registered_routes(&self) -> Vec<RouteInfo>
fn registered_routes(&self) -> Vec<RouteInfo>
The routes this application registers, as
(method, pattern) —
what AppWithState::route_entries returns; wrappers
(WithMiddleware, McpServer) report the routes of the
application inside. For tools that describe an app (the dev MCP
server’s routes tool), not for dispatch. Default: none. Since
18.28.0.Source§fn middleware_names(&self) -> Vec<&'static str>
fn middleware_names(&self) -> Vec<&'static str>
The names of the middleware layers around this application’s
routes, in the order a request passes them (
Middleware::layer_name).
Default: none; WithMiddleware lists its layers, then the inner
application’s. Since 18.28.0.Source§impl Clone for PortRouter
impl Clone for PortRouter
Source§fn clone(&self) -> PortRouter
fn clone(&self) -> PortRouter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PortRouter
impl RefUnwindSafe for PortRouter
impl Send for PortRouter
impl Sync for PortRouter
impl Unpin for PortRouter
impl UnsafeUnpin for PortRouter
impl UnwindSafe for PortRouter
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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> 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> ⓘ
Converts
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> ⓘ
Converts
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> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Available on crate feature
map-response-body only.Apply a transformation to the response body. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using gRPC headers. Read more