lspower

Struct Server

Source
pub struct Server<I, O, S = Nothing> { /* private fields */ }
Expand description

Server for processing requests and responses on standard I/O or TCP.

Implementations§

Source§

impl<I, O> Server<I, O, Nothing>
where I: AsyncRead + Unpin, O: AsyncWrite,

Source

pub fn new(stdin: I, stdout: O) -> Self

Creates a new Server with the given stdin and stdout handles.

Source§

impl<I, O, S> Server<I, O, S>
where I: AsyncRead + Unpin, O: AsyncWrite, S: Stream<Item = Outgoing>,

Source

pub fn interleave<T>(self, stream: T) -> Server<I, O, T>
where T: Stream<Item = Outgoing>,

Interleaves the given stream of messages into stdout together with the responses.

Source

pub async fn serve<T>(self, service: T)
where T: Service<Incoming, Response = Option<Outgoing>> + Send + 'static, T::Error: Into<Box<dyn Error + Send + Sync>>, T::Future: Send,

Spawns the service with messages read through stdin and responses written to stdout.

Trait Implementations§

Source§

impl<I: Debug, O: Debug, S: Debug> Debug for Server<I, O, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<I, O, S> Freeze for Server<I, O, S>
where I: Freeze, O: Freeze, S: Freeze,

§

impl<I, O, S> RefUnwindSafe for Server<I, O, S>

§

impl<I, O, S> Send for Server<I, O, S>
where I: Send, O: Send, S: Send,

§

impl<I, O, S> Sync for Server<I, O, S>
where I: Sync, O: Sync, S: Sync,

§

impl<I, O, S> Unpin for Server<I, O, S>
where I: Unpin, O: Unpin, S: Unpin,

§

impl<I, O, S> UnwindSafe for Server<I, O, S>
where I: UnwindSafe, O: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.