Struct Builder
struct Builder<E> { ... }
Http1 or Http2 connection builder.
Implementations
impl<E> Builder<E>
fn new(executor: E) -> SelfCreate a new auto connection builder.
executorparameter should be a type that implementsExecutortrait.Example
use ; new;fn http1(self: &mut Self) -> Http1Builder<'_, E>Http1 configuration.
fn http2(self: &mut Self) -> Http2Builder<'_, E>Http2 configuration.
fn http2_only(self: Self) -> SelfOnly accepts HTTP/2
Does not do anything if used with
serve_connection_with_upgradesfn http1_only(self: Self) -> SelfOnly accepts HTTP/1
Does not do anything if used with
serve_connection_with_upgradesfn is_http1_available(self: &Self) -> boolReturns
trueif this builder can serve an HTTP/1.1-based connection.fn is_http2_available(self: &Self) -> boolReturns
trueif this builder can serve an HTTP/2-based connection.fn title_case_headers(self: Self, enabled: bool) -> SelfSet whether HTTP/1 connections will write header names as title case at the socket level.
This setting only affects HTTP/1 connections. HTTP/2 connections are not affected by this setting.
Default is false.
Example
use ; new .title_case_headers;fn preserve_header_case(self: Self, enabled: bool) -> SelfSet whether HTTP/1 connections will preserve the original case of header names.
This setting only affects HTTP/1 connections. HTTP/2 connections are not affected by this setting.
Default is false.
Example
use ; new .preserve_header_case;fn serve_connection<I, S, B>(self: &Self, io: I, service: S) -> Connection<'_, I, S, E> where S: Service<Request<Incoming>, Response = Response<B>>, <S as >::Future: 'static, <S as >::Error: Into<Box<dyn StdError + Send + Sync>>, B: Body + 'static, <B as >::Error: Into<Box<dyn StdError + Send + Sync>>, I: Read + Write + Unpin + 'static, E: HttpServerConnExec<<S as >::Future, B>Bind a connection together with a
Service.fn serve_connection_with_upgrades<I, S, B>(self: &Self, io: I, service: S) -> UpgradeableConnection<'_, I, S, E> where S: Service<Request<Incoming>, Response = Response<B>>, <S as >::Future: 'static, <S as >::Error: Into<Box<dyn StdError + Send + Sync>>, B: Body + 'static, <B as >::Error: Into<Box<dyn StdError + Send + Sync>>, I: Read + Write + Unpin + Send + 'static, E: HttpServerConnExec<<S as >::Future, B>Bind a connection together with a
Service, with the ability to handle HTTP upgrades. This requires that the IO object implementsSend.Note that if you ever want to use
hyper::upgrade::Upgraded::downcastwith this crate, you'll need to usehyper_util::server::conn::auto::upgrade::downcastinstead. See the documentation of the latter to understand why.
impl<E> Freeze for Builder<E>
impl<E> RefUnwindSafe for Builder<E>
impl<E> Send for Builder<E>
impl<E> Sync for Builder<E>
impl<E> Unpin for Builder<E>
impl<E> UnsafeUnpin for Builder<E>
impl<E> UnwindSafe for Builder<E>
impl<E: $crate::clone::Clone> Clone for Builder<E>
fn clone(self: &Self) -> Builder<E>
impl<E: $crate::fmt::Debug> Debug for Builder<E>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<E: Default> Default for Builder<E>
fn default() -> Self
impl<T> Any for Builder<E>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Builder<E>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Builder<E>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Builder<E>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Builder<E>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for Builder<E>
impl<T> ToOwned for Builder<E>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> WithSubscriber for Builder<E>
impl<T, U> Into for Builder<E>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Builder<E>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Builder<E>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>