Struct kvarn_testing::ServerBuilder
source · [−]pub struct ServerBuilder { /* private fields */ }
Expand description
A builder struct for starting a test Server
.
Implementations
sourceimpl ServerBuilder
impl ServerBuilder
sourcepub fn new(extensions: Extensions, options: Options) -> Self
pub fn new(extensions: Extensions, options: Options) -> Self
Creates a new builder with extensions
and options
,
with HTTPS enabled. To disable this, call Self::http
.
Use Self::default()
for a default configuration.
Also see the From
implementations for this struct.
The inner Extensions
can be modified with Self::with_extensions
and the host::Options
with Self::with_options
sourcepub fn with_extensions(self, mutation: impl Fn(&mut Extensions)) -> Self
pub fn with_extensions(self, mutation: impl Fn(&mut Extensions)) -> Self
Modifies the internal Extensions
with mutation
.
If you already have a Extensions
, use From
.
sourcepub fn with_options(self, mutation: impl Fn(&mut Options)) -> Self
pub fn with_options(self, mutation: impl Fn(&mut Options)) -> Self
Modifies the internal host::Options
with mutation
.
If you already have a host::Options
, use From
.
sourcepub fn path(self, path: impl AsRef<Path>) -> Self
pub fn path(self, path: impl AsRef<Path>) -> Self
Sets the Host::path
of this server.
sourcepub fn enable_handover(self, path: impl AsRef<Path>) -> Self
pub fn enable_handover(self, path: impl AsRef<Path>) -> Self
Enables handover for this server.
If you are starting the server which will take over the requests, use Self::handover_from
instead.
The communication socket is at path
.
sourcepub fn handover_from(self, previous: &Server) -> Self
pub fn handover_from(self, previous: &Server) -> Self
“Steals” the requests from previous
.
Panics
Will panic if Self::enable_handover
wasn’t called on previous
’s ServerBuilder
.
Trait Implementations
sourceimpl Default for ServerBuilder
impl Default for ServerBuilder
sourceimpl From<(Extensions, Options)> for ServerBuilder
impl From<(Extensions, Options)> for ServerBuilder
sourcefn from(data: (Extensions, Options)) -> Self
fn from(data: (Extensions, Options)) -> Self
Converts to this type from the input type.
sourceimpl From<Extensions> for ServerBuilder
impl From<Extensions> for ServerBuilder
sourcefn from(extensions: Extensions) -> Self
fn from(extensions: Extensions) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for ServerBuilder
impl Send for ServerBuilder
impl Sync for ServerBuilder
impl Unpin for ServerBuilder
impl !UnwindSafe for ServerBuilder
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>
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