Struct HyperBackendBuilder

Source
pub struct HyperBackendBuilder<F, S: State = Empty> { /* private fields */ }
Available on (crate features http1 or http2 or http3) and (crate features http1 or http2) only.
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<F, S: State> HyperBackendBuilder<F, S>

Source

pub fn build(self) -> HyperBackend<F>
where S: IsComplete,

Finish building and return the requested object

Source

pub fn ctx(self, value: Context) -> HyperBackendBuilder<F, SetCtx<S>>
where S::Ctx: IsUnset,

Optional (Some / Option setters). Default: scuffle_context::Context::global().

The [scuffle_context::Context] this server will live by.

Source

pub fn maybe_ctx( self, value: Option<Context>, ) -> HyperBackendBuilder<F, SetCtx<S>>
where S::Ctx: IsUnset,

Optional (Some / Option setters). Default: scuffle_context::Context::global().

The [scuffle_context::Context] this server will live by.

Source

pub fn worker_tasks( self, value: usize, ) -> HyperBackendBuilder<F, SetWorkerTasks<S>>
where S::WorkerTasks: IsUnset,

Optional (Some / Option setters). Default: 1.

The number of worker tasks to spawn for each server backend.

Source

pub fn maybe_worker_tasks( self, value: Option<usize>, ) -> HyperBackendBuilder<F, SetWorkerTasks<S>>
where S::WorkerTasks: IsUnset,

Optional (Some / Option setters). Default: 1.

The number of worker tasks to spawn for each server backend.

Source

pub fn service_factory( self, value: F, ) -> HyperBackendBuilder<F, SetServiceFactory<S>>
where S::ServiceFactory: IsUnset,

Required.

The service factory that will be used to create new services.

Source

pub fn bind(self, value: SocketAddr) -> HyperBackendBuilder<F, SetBind<S>>
where S::Bind: IsUnset,

Required.

The address to bind to.

Use [::] for a dual-stack listener. For example, use [::]:80 to bind to port 80 on both IPv4 and IPv6.

Source

pub fn rustls_config( self, value: ServerConfig, ) -> HyperBackendBuilder<F, SetRustlsConfig<S>>
where S::RustlsConfig: IsUnset,

Optional (Some / Option setters).

rustls config.

Use this field to set the server into TLS mode. It will only accept TLS connections when this is set.

Source

pub fn maybe_rustls_config( self, value: Option<ServerConfig>, ) -> HyperBackendBuilder<F, SetRustlsConfig<S>>
where S::RustlsConfig: IsUnset,

Optional (Some / Option setters).

rustls config.

Use this field to set the server into TLS mode. It will only accept TLS connections when this is set.

Source

pub fn http1_enabled( self, value: bool, ) -> HyperBackendBuilder<F, SetHttp1Enabled<S>>
where S::Http1Enabled: IsUnset,

Optional (Some / Option setters). Default: true.

Enable HTTP/1.1.

Source

pub fn maybe_http1_enabled( self, value: Option<bool>, ) -> HyperBackendBuilder<F, SetHttp1Enabled<S>>
where S::Http1Enabled: IsUnset,

Optional (Some / Option setters). Default: true.

Enable HTTP/1.1.

Source

pub fn http2_enabled( self, value: bool, ) -> HyperBackendBuilder<F, SetHttp2Enabled<S>>
where S::Http2Enabled: IsUnset,

Optional (Some / Option setters). Default: true.

Enable HTTP/2.

Source

pub fn maybe_http2_enabled( self, value: Option<bool>, ) -> HyperBackendBuilder<F, SetHttp2Enabled<S>>
where S::Http2Enabled: IsUnset,

Optional (Some / Option setters). Default: true.

Enable HTTP/2.

Auto Trait Implementations§

§

impl<F, S> Freeze for HyperBackendBuilder<F, S>
where F: Freeze,

§

impl<F, S = Empty> !RefUnwindSafe for HyperBackendBuilder<F, S>

§

impl<F, S> Send for HyperBackendBuilder<F, S>
where F: Send,

§

impl<F, S> Sync for HyperBackendBuilder<F, S>
where F: Sync,

§

impl<F, S> Unpin for HyperBackendBuilder<F, S>
where F: Unpin,

§

impl<F, S = Empty> !UnwindSafe for HyperBackendBuilder<F, S>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

Source§

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>,

Source§

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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more