make service memory_usage()/clear_cache() async trait

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-03-15 04:07:53 +00:00
parent d8ea8b378c
commit 9ce95a7030
9 changed files with 61 additions and 44 deletions

View file

@ -31,10 +31,10 @@ pub(crate) trait Service: Any + Send + Sync {
fn interrupt(&self) {}
/// Clear any caches or similar runtime state.
fn clear_cache(&self) {}
async fn clear_cache(&self) {}
/// Memory usage report in a markdown string.
fn memory_usage(&self, _out: &mut dyn Write) -> Result<()> { Ok(()) }
async fn memory_usage(&self, _out: &mut (dyn Write + Send)) -> Result { Ok(()) }
/// Return the name of the service.
/// i.e. `crate::service::make_name(std::module_path!())`