pub struct Server<I, O, L = ClientSocket> { /* private fields */ }
Expand description
Server for processing requests and responses on standard I/O or TCP.
Implementations§
source§impl<I, O, L> Server<I, O, L>where
I: AsyncRead + Unpin,
O: AsyncWrite,
L: Loopback,
<L::ResponseSink as Sink<Response>>::Error: Error,
impl<I, O, L> Server<I, O, L>where
I: AsyncRead + Unpin,
O: AsyncWrite,
L: Loopback,
<L::ResponseSink as Sink<Response>>::Error: Error,
sourcepub fn new(stdin: I, stdout: O, socket: L) -> Self
pub fn new(stdin: I, stdout: O, socket: L) -> Self
Creates a new Server
with the given stdin
and stdout
handles.
sourcepub fn concurrency_level(self, max: usize) -> Self
pub fn concurrency_level(self, max: usize) -> Self
Sets the server concurrency limit to max
.
This setting specifies how many incoming requests may be processed concurrently. Setting
this value to 1
forces all requests to be processed sequentially, thereby implicitly
disabling support for the $/cancelRequest
notification.
If not explicitly specified, max
defaults to 4.
§Preference over standard tower
middleware
The ConcurrencyLimit
and Buffer
middlewares provided by tower
rely on
tokio::spawn
in common usage, while this library aims to be executor agnostic and to
support exotic targets currently incompatible with tokio
, such as WASM. As such, Server
includes its own concurrency facilities that don’t require a global executor to be present.