pub struct ServerBuilder { /* private fields */ }Expand description
Server builder
Implementations§
Source§impl ServerBuilder
impl ServerBuilder
Sourcepub fn bind<A: ToSocketAddrs>(self, addr: A) -> Result<Self>
pub fn bind<A: ToSocketAddrs>(self, addr: A) -> Result<Self>
Bind to the given address
Sourcepub fn max_connections(self, max: usize) -> Self
pub fn max_connections(self, max: usize) -> Self
Set maximum connections
Sourcepub fn max_frame_size(self, size: usize) -> Self
pub fn max_frame_size(self, size: usize) -> Self
Set maximum frame size
Sourcepub fn max_message_size(self, size: usize) -> Self
pub fn max_message_size(self, size: usize) -> Self
Set maximum message size
Sourcepub fn handshake_timeout(self, timeout: Duration) -> Self
pub fn handshake_timeout(self, timeout: Duration) -> Self
Set handshake timeout
Sourcepub fn idle_timeout(self, timeout: Duration) -> Self
pub fn idle_timeout(self, timeout: Duration) -> Self
Set idle timeout
Sourcepub fn compression(self, enabled: bool) -> Self
pub fn compression(self, enabled: bool) -> Self
Enable/disable compression
Sourcepub fn backpressure(self, strategy: BackpressureStrategy) -> Self
pub fn backpressure(self, strategy: BackpressureStrategy) -> Self
Set backpressure strategy
Sourcepub fn tls(
self,
cert_file: impl Into<String>,
key_file: impl Into<String>,
) -> Self
Available on crate feature tls-transport only.
pub fn tls( self, cert_file: impl Into<String>, key_file: impl Into<String>, ) -> Self
tls-transport only.Configure TLS using certificate and key files (requires tls-transport feature)
Sourcepub fn transport_tls(self) -> Self
Available on crate feature tls-transport only.
pub fn transport_tls(self) -> Self
tls-transport only.Use TLS transport instead of TCP (requires tls-transport feature)
Sourcepub fn allow_origin(self, origin: impl Into<String>) -> Self
pub fn allow_origin(self, origin: impl Into<String>) -> Self
Add an allowed origin for CORS (empty list means allow all)
Sourcepub fn build_with_handler<H>(self, handler: H) -> Result<Server>
pub fn build_with_handler<H>(self, handler: H) -> Result<Server>
Build the server with a custom handler
Trait Implementations§
Source§impl Clone for ServerBuilder
impl Clone for ServerBuilder
Source§fn clone(&self) -> ServerBuilder
fn clone(&self) -> ServerBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerBuilder
impl Debug for ServerBuilder
Auto Trait Implementations§
impl Freeze for ServerBuilder
impl RefUnwindSafe for ServerBuilder
impl Send for ServerBuilder
impl Sync for ServerBuilder
impl Unpin for ServerBuilder
impl UnsafeUnpin for ServerBuilder
impl UnwindSafe for ServerBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more