Struct tsukuyomi::server::Builder [−][src]
pub struct Builder { /* fields omitted */ }
A builder for constructing a Server
.
Methods
impl Builder
[src]
impl Builder
ⓘImportant traits for &'a mut Rpub fn transport(
&mut self,
f: impl FnOnce(&mut Builder)
) -> &mut Self
[src]
ⓘImportant traits for &'a mut R
pub fn transport(
&mut self,
f: impl FnOnce(&mut Builder)
) -> &mut Self
Modifies the tranport level configurations.
Example
let server = Server::builder() .transport(|t| { t.bind_tcp(([0, 0, 0, 0], 8888)); }) .finish(app).unwrap();
ⓘImportant traits for &'a mut Rpub fn http(
&mut self,
f: impl FnOnce(&mut Http)
) -> &mut Self
[src]
ⓘImportant traits for &'a mut R
pub fn http(
&mut self,
f: impl FnOnce(&mut Http)
) -> &mut Self
Modifies the HTTP level configurations.
Example
let server = Server::builder() .http(|http| { http.http1_only(true) .keep_alive(false); }) .finish(app).unwrap();
ⓘImportant traits for &'a mut Rpub fn runtime(
&mut self,
f: impl FnOnce(&mut Builder)
) -> &mut Self
[src]
ⓘImportant traits for &'a mut R
pub fn runtime(
&mut self,
f: impl FnOnce(&mut Builder)
) -> &mut Self
Modifies the runtime level configurations.
Example
let server = Server::builder() .runtime(|rt| { rt.threadpool_builder(ThreadPoolBuilder::new()); }) .finish(app).unwrap();
pub fn finish<S>(&mut self, new_service: S) -> Result<Server<S>, Error> where
S: NewService + Send + Sync + 'static,
S::ReqBody: From<Body>,
S::ResBody: Payload,
S::Future: Send,
S::Service: Send,
<S::Service as Service>::Future: Send,
[src]
pub fn finish<S>(&mut self, new_service: S) -> Result<Server<S>, Error> where
S: NewService + Send + Sync + 'static,
S::ReqBody: From<Body>,
S::ResBody: Payload,
S::Future: Send,
S::Service: Send,
<S::Service as Service>::Future: Send,
Create an instance of configured Server
with given NewService
.