From c2edd02745b5bdfcb8a6bb1da64e411e77855cac Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 21 May 2026 15:57:38 +0800 Subject: Change `repl_post_readline` hook to accept mutable line reference --- mingling_core/src/program/hook.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mingling_core/src/program/hook.rs') diff --git a/mingling_core/src/program/hook.rs b/mingling_core/src/program/hook.rs index f93b022..3520084 100644 --- a/mingling_core/src/program/hook.rs +++ b/mingling_core/src/program/hook.rs @@ -54,7 +54,7 @@ where /// Executes after reading a REPL line (only available with `repl` feature) #[cfg(feature = "repl")] - pub repl_post_readline: Option, + pub repl_post_readline: Option, /// Executes before executing a REPL command (only available with `repl` feature) #[cfg(feature = "repl")] @@ -252,7 +252,7 @@ where /// Runs the REPL post-readline hooks (only available with `repl` feature) #[cfg(feature = "repl")] - pub(crate) fn run_hook_repl_post_readline(&self, line: &str) { + pub(crate) fn run_hook_repl_post_readline(&self, line: &mut String) { if !self.user_context.run_hook { return; } @@ -469,9 +469,9 @@ where } /// Sets the handler for the REPL post-readline event (only available with `repl` feature). - /// This hook runs after reading a line of input and receives the line as a `&str`. + /// This hook runs after reading a line of input and receives a mutable reference to the line. #[cfg(feature = "repl")] - pub fn on_repl_post_readline(mut self, handler: fn(line: &str)) -> Self { + pub fn on_repl_post_readline(mut self, handler: fn(line: &mut String)) -> Self { let _ = self.repl_post_readline.insert(handler); self } -- cgit