Struct distant_core::DistantManager
source · [−]pub struct DistantManager { /* private fields */ }
Expand description
Represents a manager of multiple distant server connections
Implementations
sourceimpl DistantManager
impl DistantManager
sourcepub async fn start_tcp<P, C>(
config: DistantManagerConfig,
addr: IpAddr,
port: P,
codec: C
) -> Result<TcpServerRef> where
P: Into<PortRange> + Send,
C: Codec + Send + Sync + 'static,
pub async fn start_tcp<P, C>(
config: DistantManagerConfig,
addr: IpAddr,
port: P,
codec: C
) -> Result<TcpServerRef> where
P: Into<PortRange> + Send,
C: Codec + Send + Sync + 'static,
Start a new server by binding to the given IP address and one of the ports in the specified range, mapping all connections to use the given codec
sourceimpl DistantManager
impl DistantManager
sourcepub async fn start_unix_socket<P, C>(
config: DistantManagerConfig,
path: P,
codec: C
) -> Result<UnixSocketServerRef> where
P: AsRef<Path> + Send,
C: Codec + Send + Sync + 'static,
pub async fn start_unix_socket<P, C>(
config: DistantManagerConfig,
path: P,
codec: C
) -> Result<UnixSocketServerRef> where
P: AsRef<Path> + Send,
C: Codec + Send + Sync + 'static,
Start a new server using the specified path as a unix socket using default unix socket file permissions
sourcepub async fn start_unix_socket_with_permissions<P, C>(
config: DistantManagerConfig,
path: P,
codec: C,
mode: u32
) -> Result<UnixSocketServerRef> where
P: AsRef<Path> + Send,
C: Codec + Send + Sync + 'static,
pub async fn start_unix_socket_with_permissions<P, C>(
config: DistantManagerConfig,
path: P,
codec: C,
mode: u32
) -> Result<UnixSocketServerRef> where
P: AsRef<Path> + Send,
C: Codec + Send + Sync + 'static,
Start a new server using the specified path as a unix socket and mode
as the unix socket
file permissions
sourceimpl DistantManager
impl DistantManager
sourcepub fn start<L, T>(
config: DistantManagerConfig,
listener: L
) -> Result<DistantManagerRef> where
L: Listener<Output = T> + 'static,
T: IntoSplit + Send + 'static,
T::Read: UntypedTransportRead + 'static,
T::Write: UntypedTransportWrite + 'static,
pub fn start<L, T>(
config: DistantManagerConfig,
listener: L
) -> Result<DistantManagerRef> where
L: Listener<Output = T> + 'static,
T: IntoSplit + Send + 'static,
T::Read: UntypedTransportRead + 'static,
T::Write: UntypedTransportWrite + 'static,
Initializes a new instance of [DistantManagerServer
] using the provided [UntypedTransport
]
Trait Implementations
sourceimpl Server for DistantManager
impl Server for DistantManager
type Request = ManagerRequest
type Request = ManagerRequest
Type of data received by the server
type Response = ManagerResponse
type Response = ManagerResponse
Type of data sent back by the server
type LocalData = DistantManagerServerConnection
type LocalData = DistantManagerServerConnection
Type of data to store locally tied to the specific connection
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,
Invoked immediately on server start, being provided the raw listener to use (untyped transport), and returning the listener when ready to start (enabling servers that need to tweak a listener to do so) Invoked upon a new connection becoming established, which provides a mutable reference to the data created for the connection. This can be useful in performing some additional initialization on the data prior to it being used anywhere else. Read more
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
sourcefn config(&self) -> ServerConfig
fn config(&self) -> ServerConfig
Returns configuration tied to server instance
Auto Trait Implementations
impl !RefUnwindSafe for DistantManager
impl Send for DistantManager
impl Sync for DistantManager
impl Unpin for DistantManager
impl !UnwindSafe for DistantManager
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