pub struct Server<Context: Context> { /* private fields */ }
Implementations§
Source§impl<Context: Context> Server<Context>
impl<Context: Context> Server<Context>
pub fn for_http(self) -> HttpServer<Context>
pub fn middleware<T: Middleware<Context>>( self, middleware: T, ) -> HttpServer<Context>
Source§impl<Context: Context> Server<Context>
impl<Context: Context> Server<Context>
pub fn run_socket<'a, T: AsyncRead + AsyncWrite + Send>( &'a self, listener: impl Stream<Item = Result<T>> + 'a, error_handler: impl Fn(Error) + Sync + 'a, ) -> (ShutdownHandle, impl Future<Output = ()> + 'a)
pub fn run_unix<'a>( &'a self, path: impl AsRef<Path> + 'a, error_handler: impl Fn(Error) + Sync + 'a, ) -> Result<(ShutdownHandle, impl Future<Output = ()> + 'a)>
pub async fn run_tcp<'a>( &'a self, addr: impl ToSocketAddrs + 'a, error_handler: impl Fn(Error) + Sync + 'a, ) -> Result<(ShutdownHandle, impl Future<Output = ()> + 'a)>
Source§impl<Context: Context> Server<Context>
impl<Context: Context> Server<Context>
pub fn new<MakeCtx: Fn() -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Context, RpcError>> + Send + 'static>( make_ctx: MakeCtx, root_handler: ParentHandler<Context>, ) -> Self
pub fn handle_command( &self, method: &str, params: Value, ) -> impl Future<Output = Result<Value, RpcError>> + Send + 'static
pub fn handle( &self, request: Result<Value, RpcError>, ) -> BoxFuture<'static, Result<Value, Error>>
pub fn stream<'a>( &'a self, requests: impl Stream<Item = Result<Value, RpcError>> + Send + 'a, ) -> impl Stream<Item = Result<Value, Error>> + 'a
Trait Implementations§
Auto Trait Implementations§
impl<Context> Freeze for Server<Context>
impl<Context> !RefUnwindSafe for Server<Context>
impl<Context> Send for Server<Context>
impl<Context> Sync for Server<Context>
impl<Context> Unpin for Server<Context>
impl<Context> !UnwindSafe for Server<Context>
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