pub struct DevReload<S> { /* private fields */ }Expand description
Serves an artifact while it is rebuilt, for development.
A build tool such as vite build --watch rewrites the artifact directory
and writes fetchlet.json last. When the manifest changes, DevReload
opens the artifact again, builds a new Generation with the caller’s
function, serves it from then on and shuts the previous applications down
after their accepted calls finish. A failed reload is reported and the
previous generation keeps serving.
DevReload::service serves the current generation and reloads browsers
that show one of its HTML pages when a new one starts. A host that serves
without a Tower service, such as a webview URI scheme, takes
DevReload::current for each request and reloads its views when
DevReload::reloads reports a new generation.
Implementations§
Source§impl DevReload<()>
impl DevReload<()>
Sourcepub fn watch(directory: impl Into<PathBuf>) -> DevReloadBuilder
pub fn watch(directory: impl Into<PathBuf>) -> DevReloadBuilder
Watch the artifact in directory.
Source§impl<S: Clone> DevReload<S>
impl<S: Clone> DevReload<S>
Sourcepub fn service(&self) -> DevService<S>
pub fn service(&self) -> DevService<S>
A service that dispatches each request to the current generation.
Sourcepub async fn shutdown(&self) -> Result<(), ReloadError>
pub async fn shutdown(&self) -> Result<(), ReloadError>
Stop watching and shut down the current generation’s applications. Requests that reach the generation afterwards fail as calls to a shut down application do.