pub struct Bootstrap { /* private fields */ }Expand description
Builds and serves a Laterite application.
Implementations§
Source§impl Bootstrap
impl Bootstrap
Sourcepub fn new(config_dir: impl Into<PathBuf>) -> Self
pub fn new(config_dir: impl Into<PathBuf>) -> Self
Loads config from config_dir (default.toml, the APP_ENV overlay, and
local.toml). Env vars override under the prefix the config declares as
app.env_prefix, else DEFAULT_ENV_PREFIX; Bootstrap::env_prefix
overrides both.
Sourcepub fn env_prefix(self, prefix: impl Into<String>) -> Self
pub fn env_prefix(self, prefix: impl Into<String>) -> Self
Overrides the config env-var prefix from code, above the config’s own
app.env_prefix declaration and DEFAULT_ENV_PREFIX.
Sourcepub fn module(self, module: impl Module) -> Self
pub fn module(self, module: impl Module) -> Self
Registers one of the application’s own modules, after the built-in ones. Its
migrations and contributions run after those of the modules it names in
requires. App modules are load-critical: a failure at boot aborts, rather
than being quarantined like a plugin registered with Bootstrap::modules.
Sourcepub fn modules(self, modules: Vec<Box<dyn Module>>) -> Self
pub fn modules(self, modules: Vec<Box<dyn Module>>) -> Self
Registers a set of plugins, typically the generated plugins-manifest.
Plugins are isolated at boot: one that fails to migrate or register is
quarantined (logged and skipped, taking its dependents with it) rather than
aborting the whole application.
Sourcepub fn extend(
self,
f: impl FnOnce(Router, &BootstrapCtx) -> Router + 'static,
) -> Self
pub fn extend( self, f: impl FnOnce(Router, &BootstrapCtx) -> Router + 'static, ) -> Self
Merges the app’s own routes onto the admin router before serving. The
closure gets the assembled router and a BootstrapCtx.
Auto Trait Implementations§
impl !RefUnwindSafe for Bootstrap
impl !Send for Bootstrap
impl !Sync for Bootstrap
impl !UnwindSafe for Bootstrap
impl Freeze for Bootstrap
impl Unpin for Bootstrap
impl UnsafeUnpin for Bootstrap
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more