Struct quic_rpc::server::RpcServer

source ·
pub struct RpcServer<S: Service, C: ChannelTypes> { /* private fields */ }
Expand description

A server channel for a specific service.

This is a wrapper around a crate::ServerChannel that serves as the entry point for the server DSL. S is the service type, C is the channel type.

Implementations§

Create a new server channel from a channel and a service type.

The local addresses this server is bound to.

This is useful for publicly facing addresses when you start the server with a random port, :0 and let the kernel choose the real bind address. This will return the address with the actual port used.

Accepts a connection, handling the first request.

This accepts a new client connection, which is represented as a tuple of a sender and receiver channel.

The return value is a tuple of (request, (channel_sender, channel_receiver)). Here request is the first request which is already read from the channel. The channels are used to send responses and/or receive more requests.

A rpc call that also maps the error from the user type to the wire type

This is useful if you want to write your function with a convenient error type like anyhow::Error, yet still use a serializable error type on the wire.

handle the message M using the given function on the target object

If you want to support concurrent requests, you need to spawn this on a tokio task yourself.

handle the message M using the given function on the target object

If you want to support concurrent requests, you need to spawn this on a tokio task yourself.

handle the message M using the given function on the target object

If you want to support concurrent requests, you need to spawn this on a tokio task yourself.

handle the message M using the given function on the target object

If you want to support concurrent requests, you need to spawn this on a tokio task yourself.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more