pub struct IpcServer<RpcMiddleware = Identity> { /* private fields */ }Expand description
Ipc Server implementation
This is an adapted jsonrpsee Server, but for Ipc connections.
Implementations§
Source§impl<RpcMiddleware> IpcServer<RpcMiddleware>where
RpcMiddleware: Layer<RpcService> + Clone + Send + 'static,
RpcMiddleware::Service: RpcServiceT + Send + Sync + 'static,
impl<RpcMiddleware> IpcServer<RpcMiddleware>where
RpcMiddleware: Layer<RpcService> + Clone + Send + 'static,
RpcMiddleware::Service: RpcServiceT + Send + Sync + '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.
Returns an error if the endpoint cannot be opened or the requested Unix socket permissions cannot be parsed or applied before serving requests.
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<RpcMiddleware = Identity> !RefUnwindSafe for IpcServer<RpcMiddleware>
impl<RpcMiddleware = Identity> !UnwindSafe for IpcServer<RpcMiddleware>
impl<RpcMiddleware> Freeze for IpcServer<RpcMiddleware>where
RpcServiceBuilder<RpcMiddleware>: Freeze,
impl<RpcMiddleware> Send for IpcServer<RpcMiddleware>where
RpcServiceBuilder<RpcMiddleware>: Send,
impl<RpcMiddleware> Sync for IpcServer<RpcMiddleware>where
RpcServiceBuilder<RpcMiddleware>: Sync,
impl<RpcMiddleware> Unpin for IpcServer<RpcMiddleware>where
RpcServiceBuilder<RpcMiddleware>: Unpin,
impl<RpcMiddleware> UnsafeUnpin for IpcServer<RpcMiddleware>where
RpcServiceBuilder<RpcMiddleware>: UnsafeUnpin,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§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> ⓘ
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.