pub struct IpcServer<HttpMiddleware = Identity, RpcMiddleware = Identity> { /* private fields */ }
Expand description
Ipc Server implementation
This is an adapted jsonrpsee
Server, but for Ipc
connections.
Implementations§
Source§impl<HttpMiddleware, RpcMiddleware> IpcServer<HttpMiddleware, RpcMiddleware>where
RpcMiddleware: for<'a> Layer<RpcService, Service: RpcServiceT<'a>> + Clone + Send + 'static,
HttpMiddleware: Layer<TowerServiceNoHttp<RpcMiddleware>, Service: Service<String, Response = Option<String>, Error = Box<dyn Error + Send + Sync + 'static>, Future: Send + Unpin> + Send> + Send + 'static,
impl<HttpMiddleware, RpcMiddleware> IpcServer<HttpMiddleware, RpcMiddleware>where
RpcMiddleware: for<'a> Layer<RpcService, Service: RpcServiceT<'a>> + Clone + Send + 'static,
HttpMiddleware: Layer<TowerServiceNoHttp<RpcMiddleware>, Service: Service<String, Response = Option<String>, Error = Box<dyn Error + Send + Sync + 'static>, Future: Send + Unpin> + Send> + Send + 'static,
Sourcepub async fn start(
self,
methods: impl Into<Methods>,
) -> Result<ServerHandle, IpcServerStartError>
pub async fn start( self, methods: impl Into<Methods>, ) -> Result<ServerHandle, IpcServerStartError>
Start responding to connections requests.
This will run on the tokio runtime until the server is stopped or the ServerHandle
is
dropped.
use jsonrpsee::RpcModule;
use reth_ipc::server::Builder;
async fn run_server() -> Result<(), Box<dyn core::error::Error + Send + Sync>> {
let server = Builder::default().build("/tmp/my-uds".into());
let mut module = RpcModule::new(());
module.register_method("say_hello", |_, _, _| "lo")?;
let handle = server.start(module).await?;
// In this example we don't care about doing shutdown so let's it run forever.
// You may use the `ServerHandle` to shut it down or manage it yourself.
let server = tokio::spawn(handle.stopped());
server.await.unwrap();
Ok(())
}
Trait Implementations§
Auto Trait Implementations§
impl<HttpMiddleware, RpcMiddleware> Freeze for IpcServer<HttpMiddleware, RpcMiddleware>
impl<HttpMiddleware = Identity, RpcMiddleware = Identity> !RefUnwindSafe for IpcServer<HttpMiddleware, RpcMiddleware>
impl<HttpMiddleware, RpcMiddleware> Send for IpcServer<HttpMiddleware, RpcMiddleware>
impl<HttpMiddleware, RpcMiddleware> Sync for IpcServer<HttpMiddleware, RpcMiddleware>
impl<HttpMiddleware, RpcMiddleware> Unpin for IpcServer<HttpMiddleware, RpcMiddleware>
impl<HttpMiddleware = Identity, RpcMiddleware = Identity> !UnwindSafe for IpcServer<HttpMiddleware, RpcMiddleware>
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSendSync for T
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.