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 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.
Auto Trait Implementations§
impl Freeze for FireBuilder
impl !RefUnwindSafe for FireBuilder
impl Send for FireBuilder
impl Sync for FireBuilder
impl Unpin for FireBuilder
impl !UnwindSafe for FireBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more