Struct fire_http::FireBuilder
source · pub struct FireBuilder { /* private fields */ }Expand description
FireBuilder gathers all materials needed to light a fire (start a server).
Implementations§
source§impl FireBuilder
impl FireBuilder
pub fn add_data<D>(&mut self, data: D)
sourcepub fn add_raw_route<R>(&mut self, route: R)where
R: RawRoute + 'static,
pub fn add_raw_route<R>(&mut self, route: R)where
R: RawRoute + 'static,
Adds a RawRoute to the fire.
sourcepub fn add_route<R>(&mut self, route: R)where
R: IntoRoute + 'static,
pub fn add_route<R>(&mut self, route: R)where
R: IntoRoute + 'static,
Adds a Route to the fire.
sourcepub fn add_catcher<C>(&mut self, catcher: C)where
C: Catcher + 'static,
pub fn add_catcher<C>(&mut self, catcher: C)where
C: Catcher + 'static,
Adds a Catcher to the fire.
sourcepub fn request_size_limit(&mut self, size_limit: usize)
pub fn request_size_limit(&mut self, size_limit: usize)
Sets the request size limit. The default is 4 kilobytes.
This can be changed in every Route.
§Panics
If the size is zero.
sourcepub fn request_timeout(&mut self, timeout: Duration)
pub fn request_timeout(&mut self, timeout: Duration)
Sets the request timeout. The default is 60 seconds.
This can be changed in every Route.
sourcepub fn hide_startup_message(&mut self)
pub fn hide_startup_message(&mut self)
Prevents the fire from showing a message when the server get’s started.
sourcepub async fn build(self) -> Result<Fire>
pub async fn build(self) -> Result<Fire>
Binds to the address and prepares to serve requests.
You need to call ignite on the Fire so that it starts handling
requests.
sourcepub async fn ignite(self) -> Result<()>
pub async fn ignite(self) -> Result<()>
Ignites the fire, which starts the server.
§Note
Under normal conditions this function should run forever.
sourcepub fn ignite_task(self) -> JoinHandle<()>
pub fn ignite_task(self) -> JoinHandle<()>
Ignites the fire, and spawns it on a new tokio task.
§Note
Under normal conditions this task should run forever.