pub struct TfServer<C>where
C: TfCodec,{ /* private fields */ }Expand description
Base binary TCP server.
C is the codec used to encode/decode data.
Recommended default codec is LengthDelimitedCodec from the server codec module.
Implementations§
Source§impl<C> TfServer<C>where
C: TfCodec,
impl<C> TfServer<C>where
C: TfCodec,
Sourcepub async fn new(
bind_address: String,
router: Arc<TfServerRouter<C>>,
processor: Option<TrafficProcessorHolder<C>>,
codec: C,
config: Option<ServerConfig>,
mode: ServerMode,
) -> Result<Self, Error>
pub async fn new( bind_address: String, router: Arc<TfServerRouter<C>>, processor: Option<TrafficProcessorHolder<C>>, codec: C, config: Option<ServerConfig>, mode: ServerMode, ) -> Result<Self, Error>
Creates a new server instance bound to bind_address.
Returns an error if the address cannot be bound.
Sourcepub async fn start(&mut self) -> JoinHandle<()>
pub async fn start(&mut self) -> JoinHandle<()>
Start the task for handling connections.
Returns the join handle for the acceptor task.
Auto Trait Implementations§
impl<C> !RefUnwindSafe for TfServer<C>
impl<C> !UnwindSafe for TfServer<C>
impl<C> Freeze for TfServer<C>where
C: Freeze,
impl<C> Send for TfServer<C>
impl<C> Sync for TfServer<C>
impl<C> Unpin for TfServer<C>where
C: Unpin,
impl<C> UnsafeUnpin for TfServer<C>where
C: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more