use super::{bootstrap, CoreError, Module, RuestApplication};
pub struct RuestFactory;
impl RuestFactory {
pub fn create<M: Module>(root: M) -> Result<ApplicationBuilder, CoreError> {
let app = bootstrap(root)?;
Ok(ApplicationBuilder { app })
}
}
pub struct ApplicationBuilder {
app: RuestApplication,
}
impl ApplicationBuilder {
pub fn port(mut self, port: u16) -> Self {
self.app.set_port(port);
self
}
pub fn host(mut self, host: impl Into<String>) -> Self {
self.app.set_host(host);
self
}
pub fn build(self) -> RuestApplication {
self.app
}
}