1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
use crate::{ msg::content::{Content, InternalDebugArgs}, server::{action::ActionError, state::ServerState}, }; use log::debug; use std::future::Future; use std::sync::Arc; pub async fn internal_debug<F, R>( state: Arc<ServerState>, args: &InternalDebugArgs, respond: F, ) -> Result<(), ActionError> where F: FnOnce(Content) -> R, R: Future<Output = Result<(), ActionError>>, { debug!("internal_debug_request"); let mut output = vec![]; output.extend_from_slice(state.internal_debug().await.as_bytes()); respond(Content::InternalDebug(InternalDebugArgs { input: args.input.clone(), output, })) .await }