Struct distant_net::server::Server

source ·
pub struct Server<T> { /* private fields */ }
Expand description

Represents a server that can be used to receive requests & send responses to clients.

Implementations§

source§

impl<T> Server<T>

source

pub fn into_tcp_builder(self) -> TcpServerBuilder<T>

Consume Server and produce a builder for a TCP variant.

source§

impl<T> Server<T>

source

pub fn into_unix_socket_builder(self) -> UnixSocketServerBuilder<T>

Consume Server and produce a builder for a Unix socket variant.

source§

impl Server<()>

source

pub fn new() -> Self

Creates a new Server, starting with a default configuration, no authentication methods, and no ServerHandler.

source

pub fn tcp() -> TcpServerBuilder<()>

Creates a new TcpServerBuilder that is used to construct a Server.

source

pub fn unix_socket() -> UnixSocketServerBuilder<()>

Creates a new UnixSocketServerBuilder that is used to construct a Server.

source§

impl<T> Server<T>

source

pub fn config(self, config: ServerConfig) -> Self

Consumes the current server, replacing its config with config and returning it.

source

pub fn handler<U>(self, handler: U) -> Server<U>

Consumes the current server, replacing its handler with handler and returning it.

source

pub fn verifier(self, verifier: Verifier) -> Self

Consumes the current server, replacing its verifier with verifier and returning it.

source

pub fn version(self, version: Version) -> Self

Consumes the current server, replacing its version with version and returning it.

source§

impl<T> Server<T>where T: ServerHandler + Sync + 'static, T::Request: DeserializeOwned + Send + Sync + 'static, T::Response: Serialize + Send + 'static,

source

pub fn start<L>(self, listener: L) -> Result<ServerRef>where L: Listener + 'static, L::Output: Transport + 'static,

Consumes the server, starting a task to process connections from the listener and returning a ServerRef that can be used to control the active server instance.

Trait Implementations§

source§

impl Default for Server<()>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Server<T>

§

impl<T> Send for Server<T>where T: Send,

§

impl<T> Sync for Server<T>where T: Sync,

§

impl<T> Unpin for Server<T>where T: Unpin,

§

impl<T> !UnwindSafe for Server<T>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for Twhere T: 'static,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts reference to Any
source§

fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)

Converts mutable reference to Any
source§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

Consumes and produces Box<dyn Any>
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V