Struct tcpserver::Builder

source ·
pub struct Builder<I, R, A, T, B, C, IST> { /* private fields */ }
Expand description

TCP server builder

Implementations§

source§

impl<I, R, A, T, B, C, IST> Builder<I, R, A, T, B, C, IST>
where I: Fn(ReadHalf<C>, Arc<Actor<TCPPeer<C>>>, T) -> R + Send + Sync + 'static, R: Future<Output = Result<()>> + Send + 'static, A: ToSocketAddrs, T: Clone + Send + 'static, B: Future<Output = Result<C>> + Send + 'static, C: AsyncRead + AsyncWrite + Send + 'static, IST: Fn(TcpStream) -> B + Send + Sync + 'static,

source

pub fn new(addr: A) -> Builder<I, R, A, T, B, C, IST>

source

pub fn set_input_event(self, f: I) -> Self

设置TCP server 输入事件

source

pub fn set_connect_event(self, c: ConnectEventType) -> Self

设置TCP server 连接事件

source

pub fn set_stream_init(self, c: IST) -> Self

设置输入流类型,例如TCPStream,SSLStream or GZIPStream

source

pub async fn build(self) -> Arc<Actor<TCPServer<I, R, T, B, C, IST>>>

生成TCPSERVER,如果没有设置 tcp input 将报错

Auto Trait Implementations§

§

impl<I, R, A, T, B, C, IST> RefUnwindSafe for Builder<I, R, A, T, B, C, IST>

§

impl<I, R, A, T, B, C, IST> Send for Builder<I, R, A, T, B, C, IST>
where A: Send, B: Send, C: Send, I: Send, IST: Send, R: Send, T: Send,

§

impl<I, R, A, T, B, C, IST> Sync for Builder<I, R, A, T, B, C, IST>
where A: Sync, B: Sync, C: Sync, I: Sync, IST: Sync, R: Sync, T: Sync,

§

impl<I, R, A, T, B, C, IST> Unpin for Builder<I, R, A, T, B, C, IST>
where A: Unpin, B: Unpin, C: Unpin, I: Unpin, IST: Unpin, R: Unpin, T: Unpin,

§

impl<I, R, A, T, B, C, IST> UnwindSafe for Builder<I, R, A, T, B, C, IST>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where 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 T
where 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.