HyperServer

Struct HyperServer 

Source
#[non_exhaustive]
pub struct HyperServer<Transport> { pub transport: Transport, pub hyper_cfg: HyperCfg, }
Expand description

A Fragment for hyper servers.

This is a wrapper around a Transport Fragment. It takes something that accepts connections ‒ like TcpListen and adds configuration specific for a HTTP server.

The Fragment produces hyper Builder. The BuildServer transformation can be used to make it into a Server and install it into a tokio runtime.

See also the HttpServer type alias.

§Configuration options

In addition to options already provided by the Transport, these options are added:

  • http1-keepalive: boolean, default true.
  • http-mode: One of "both", "http1-only" or "http2-only". Defaults to "both".

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§transport: Transport

The inner transport.

This is accessible by the user in case it contains something of use to the Transformations.

§hyper_cfg: HyperCfg

Configuration of Hyper.

The HTTP configuration is inside this.

Trait Implementations§

Source§

impl<Transport: Clone> Clone for HyperServer<Transport>

Source§

fn clone(&self) -> HyperServer<Transport>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Transport: Comparable> Comparable for HyperServer<Transport>

Source§

fn compare(&self, other: &Self) -> Comparison

Compares two fragments.
Source§

impl<Transport: Debug> Debug for HyperServer<Transport>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Transport: Default> Default for HyperServer<Transport>

Source§

fn default() -> HyperServer<Transport>

Returns the “default value” for a type. Read more
Source§

impl<'de, Transport> Deserialize<'de> for HyperServer<Transport>
where Transport: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<Transport> Fragment for HyperServer<Transport>
where Transport: Fragment + Debug + Clone + Comparable,

Source§

type Driver = CacheSimilar<HyperServer<Transport>>

The default driver to be used by the fragment. Read more
Source§

type Installer = ()

The default installer to be used unless a transformation or the user doesn’t provide one. Read more
Source§

type Seed = <Transport as Fragment>::Seed

The intermediate product if the fragment supports two-stage creation of Resources. If not, it can be set to ().
Source§

type Resource = Builder<Acceptor<<Transport as Fragment>::Resource>>

The actual product this Fragment creates.
Source§

fn make_seed(&self, name: &'static str) -> Result<Self::Seed, AnyError>

Runs the first stage of creation. Read more
Source§

fn make_resource( &self, seed: &mut Self::Seed, name: &'static str, ) -> Result<Self::Resource, AnyError>

Runs the second stage of creation. Read more
Source§

const RUN_BEFORE_CONFIG: bool = false

Configuration if the pipeline should be run once even before the config is loaded. Read more
Source§

fn create( &self, name: &'static str, ) -> Result<Self::Resource, Box<dyn Error + Sync + Send>>

Runs both stages of creation at once. Read more
Source§

fn init<B>( builder: B, _: &'static str, ) -> Result<B, Box<dyn Error + Sync + Send>>
where B: Extensible<Ok = B>, <B as Extensible>::Config: DeserializeOwned + Send + Sync + 'static, <B as Extensible>::Opts: StructOpt + Send + Sync + 'static,

An initialization routine. Read more
Source§

impl<Transport: Hash> Hash for HyperServer<Transport>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<Transport: Ord> Ord for HyperServer<Transport>

Source§

fn cmp(&self, other: &HyperServer<Transport>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<Transport: PartialEq> PartialEq for HyperServer<Transport>

Source§

fn eq(&self, other: &HyperServer<Transport>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Transport: PartialOrd> PartialOrd for HyperServer<Transport>

Source§

fn partial_cmp(&self, other: &HyperServer<Transport>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<Transport> Serialize for HyperServer<Transport>
where Transport: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<Transport> StructDoc for HyperServer<Transport>
where Transport: StructDoc,

Source§

fn document() -> Documentation

Returns the documentation for the type. Read more
Source§

impl<Tr, Inst, BS> Transformation<Builder<Acceptor<<Tr as Fragment>::Resource>>, Inst, HyperServer<Tr>> for BuildServer<BS>
where Tr: Fragment + Clone + Send + 'static, Tr::Resource: Send, BS: ServerBuilder<Tr> + Clone + Send + 'static, BS::OutputFut: Future<Output = Result<(), Error>>,

Source§

type OutputResource = Activate<<BS as ServerBuilder<Tr>>::OutputFut>

The type of resource after the transformation.
Source§

type OutputInstaller = FutureInstaller

The type of installer after the transformation. Read more
Source§

fn installer(&mut self, _ii: Inst, _name: &'static str) -> Self::OutputInstaller

Creates the installer. Read more
Source§

fn transform( &mut self, builder: Builder<Acceptor<Tr::Resource>>, cfg: &HyperServer<Tr>, name: &'static str, ) -> Result<Self::OutputResource, AnyError>

Transforms one instance of the resource. Read more
Source§

impl<Transport: Eq> Eq for HyperServer<Transport>

Source§

impl<Transport> Stackable for HyperServer<Transport>
where Transport: Stackable,

Source§

impl<Transport> StructuralPartialEq for HyperServer<Transport>

Auto Trait Implementations§

§

impl<Transport> Freeze for HyperServer<Transport>
where Transport: Freeze,

§

impl<Transport> RefUnwindSafe for HyperServer<Transport>
where Transport: RefUnwindSafe,

§

impl<Transport> Send for HyperServer<Transport>
where Transport: Send,

§

impl<Transport> Sync for HyperServer<Transport>
where Transport: Sync,

§

impl<Transport> Unpin for HyperServer<Transport>
where Transport: Unpin,

§

impl<Transport> UnwindSafe for HyperServer<Transport>
where Transport: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, Box<dyn Error + Sync + Send>>

Turns self into the result.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<F> Optional for F
where F: Stackable,