pub struct Server<I, O, L = ClientSocket> { /* private fields */ }
Expand description
Server for processing requests and responses on standard I/O or TCP.
Implementations
sourceimpl<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.
Trait Implementations
Auto Trait Implementations
impl<I, O, L> RefUnwindSafe for Server<I, O, L> where
I: RefUnwindSafe,
L: RefUnwindSafe,
O: RefUnwindSafe,
impl<I, O, L> Send for Server<I, O, L> where
I: Send,
L: Send,
O: Send,
impl<I, O, L> Sync for Server<I, O, L> where
I: Sync,
L: Sync,
O: Sync,
impl<I, O, L> Unpin for Server<I, O, L> where
I: Unpin,
L: Unpin,
O: Unpin,
impl<I, O, L> UnwindSafe for Server<I, O, L> where
I: UnwindSafe,
L: UnwindSafe,
O: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more