Struct distant_core::DistantApiServer
source · [−]pub struct DistantApiServer<T, D> where
T: DistantApi<LocalData = D>, { /* private fields */ }
Expand description
Represents a server that leverages an API compliant with distant
Implementations
sourceimpl<T, D> DistantApiServer<T, D> where
T: DistantApi<LocalData = D>,
impl<T, D> DistantApiServer<T, D> where
T: DistantApi<LocalData = D>,
sourceimpl DistantApiServer<LocalDistantApi, <LocalDistantApi as DistantApi>::LocalData>
impl DistantApiServer<LocalDistantApi, <LocalDistantApi as DistantApi>::LocalData>
sourcepub fn local(config: ServerConfig) -> Result<Self>
pub fn local(config: ServerConfig) -> Result<Self>
Creates a new server using the LocalDistantApi
implementation
Trait Implementations
sourceimpl<T, D> Server for DistantApiServer<T, D> where
T: DistantApi<LocalData = D> + Send + Sync,
D: Send + Sync,
impl<T, D> Server for DistantApiServer<T, D> where
T: DistantApi<LocalData = D> + Send + Sync,
D: Send + Sync,
sourcefn config(&self) -> ServerConfig
fn config(&self) -> ServerConfig
Overridden to leverage DistantApi
implementation of config
sourcefn on_accept<'life0, 'life1, 'async_trait>(
&'life0 self,
local_data: &'life1 mut Self::LocalData
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn on_accept<'life0, 'life1, 'async_trait>(
&'life0 self,
local_data: &'life1 mut Self::LocalData
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Overridden to leverage DistantApi
implementation of on_accept
type Request = DistantMsg<DistantRequestData>
type Request = DistantMsg<DistantRequestData>
Type of data received by the server
type Response = DistantMsg<DistantResponseData>
type Response = DistantMsg<DistantResponseData>
Type of data sent back by the server
type LocalData = D
type LocalData = D
Type of data to store locally tied to the specific connection
sourcefn on_request<'life0, 'async_trait>(
&'life0 self,
ctx: ServerCtx<Self::Request, Self::Response, Self::LocalData>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn on_request<'life0, 'async_trait>(
&'life0 self,
ctx: ServerCtx<Self::Request, Self::Response, Self::LocalData>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Invoked upon receiving a request from a client. The server should process this
request, which can be found in ctx
, and send one or more replies in response. Read more
Auto Trait Implementations
impl<T, D> RefUnwindSafe for DistantApiServer<T, D> where
T: RefUnwindSafe,
impl<T, D> Send for DistantApiServer<T, D> where
T: Send,
impl<T, D> Sync for DistantApiServer<T, D> where
T: Sync,
impl<T, D> Unpin for DistantApiServer<T, D> where
T: Unpin,
impl<T, D> UnwindSafe for DistantApiServer<T, D> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<S, Req, Res, Data> ServerExt for S where
S: 'static + Server<Request = Req, Response = Res, LocalData = Data> + Sync,
Req: 'static + DeserializeOwned + Send + Sync,
Res: 'static + Serialize + Send,
Data: 'static + Default + Send + Sync,
impl<S, Req, Res, Data> ServerExt for S where
S: 'static + Server<Request = Req, Response = Res, LocalData = Data> + Sync,
Req: 'static + DeserializeOwned + Send + Sync,
Res: 'static + Serialize + Send,
Data: 'static + Default + Send + Sync,
type Request = Req
type Response = Res
sourcefn start<L, R, W>(
self,
listener: L
) -> Result<Box<dyn ServerRef + 'static, Global>, Error> where
L: 'static + Listener<Output = (W, R)>,
R: 'static + TypedAsyncRead<Request<<S as ServerExt>::Request>> + Send,
W: 'static + TypedAsyncWrite<Response<<S as ServerExt>::Response>> + Send,
fn start<L, R, W>(
self,
listener: L
) -> Result<Box<dyn ServerRef + 'static, Global>, Error> where
L: 'static + Listener<Output = (W, R)>,
R: 'static + TypedAsyncRead<Request<<S as ServerExt>::Request>> + Send,
W: 'static + TypedAsyncWrite<Response<<S as ServerExt>::Response>> + Send,
Start a new server using the provided listener
sourceimpl<S, Req, Res, Data> TcpServerExt for S where
S: 'static + Server<Request = Req, Response = Res, LocalData = Data> + Sync,
Req: 'static + DeserializeOwned + Send + Sync,
Res: 'static + Serialize + Send,
Data: 'static + Default + Send + Sync,
impl<S, Req, Res, Data> TcpServerExt for S where
S: 'static + Server<Request = Req, Response = Res, LocalData = Data> + Sync,
Req: 'static + DeserializeOwned + Send + Sync,
Res: 'static + Serialize + Send,
Data: 'static + Default + Send + Sync,
type Request = Req
type Response = Res
sourcefn start<'async_trait, P, C>(
self,
addr: IpAddr,
port: P,
codec: C
) -> Pin<Box<dyn Future<Output = Result<TcpServerRef, Error>> + Send + 'async_trait, Global>> where
P: Into<PortRange> + Send + 'async_trait,
C: 'static + Codec + Send + Sync + 'async_trait,
S: 'async_trait,
fn start<'async_trait, P, C>(
self,
addr: IpAddr,
port: P,
codec: C
) -> Pin<Box<dyn Future<Output = Result<TcpServerRef, Error>> + Send + 'async_trait, Global>> where
P: Into<PortRange> + Send + 'async_trait,
C: 'static + Codec + Send + Sync + 'async_trait,
S: 'async_trait,
Start a new server using the provided listener
sourceimpl<S, Req, Res, Data> UnixSocketServerExt for S where
S: 'static + Server<Request = Req, Response = Res, LocalData = Data> + Sync,
Req: 'static + DeserializeOwned + Send + Sync,
Res: 'static + Serialize + Send,
Data: 'static + Default + Send + Sync,
impl<S, Req, Res, Data> UnixSocketServerExt for S where
S: 'static + Server<Request = Req, Response = Res, LocalData = Data> + Sync,
Req: 'static + DeserializeOwned + Send + Sync,
Res: 'static + Serialize + Send,
Data: 'static + Default + Send + Sync,
type Request = Req
type Response = Res
sourcefn start<'async_trait, P, C>(
self,
path: P,
codec: C
) -> Pin<Box<dyn Future<Output = Result<UnixSocketServerRef, Error>> + Send + 'async_trait, Global>> where
P: AsRef<Path> + Send + 'async_trait,
C: 'static + Codec + Send + Sync + 'async_trait,
S: 'async_trait,
fn start<'async_trait, P, C>(
self,
path: P,
codec: C
) -> Pin<Box<dyn Future<Output = Result<UnixSocketServerRef, Error>> + Send + 'async_trait, Global>> where
P: AsRef<Path> + Send + 'async_trait,
C: 'static + Codec + Send + Sync + 'async_trait,
S: 'async_trait,
Start a new server using the provided listener
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn 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>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more