- Removed unused `id` and `app_state` fields from `ChatPanel`; updated constructor to accept but ignore the state, reducing memory footprint. - Switched database access in `ChatPanel` from a raw `Mutex` lock to a connection pool (`app_state.conn.get()`), improving concurrency and error handling. - Reordered and cleaned up imports in `status_panel.rs` and formatted struct fields for readability. - Updated VS Code launch configuration to pass `--noui` argument, enabling headless mode for debugging. - Bumped several crate versions in `Cargo.lock` (e.g., `bitflags` to 2.10.0, `syn` to 2.0.108, `cookie` to 0.16.2) and added the new `ashpd` dependency, aligning the project with latest library releases.
14 lines
410 B
Rust
14 lines
410 B
Rust
use rhai::Dynamic;
|
|
use rhai::Engine;
|
|
pub fn first_keyword(engine: &mut Engine) {
|
|
engine
|
|
.register_custom_syntax(&["FIRST", "$expr$"], false, {
|
|
move |context, inputs| {
|
|
let input_string = context.eval_expression_tree(&inputs[0])?;
|
|
let input_str = input_string.to_string();
|
|
let first_word = input_str.split_whitespace().next().unwrap_or("").to_string();
|
|
Ok(Dynamic::from(first_word))
|
|
}
|
|
})
|
|
.unwrap();
|
|
}
|