spring_ai_rs/ai_interface/callback/drawer/
line.rs

1use spring_ai_sys::COMMAND_TO_ID_ENGINE;
2
3use crate::ai_interface::callback::{
4    command::{
5        command_data::{drawer::AddLineDrawCommandData, CommandData},
6        command_topic::CommandTopic,
7    },
8    engine::handle_command,
9};
10
11pub struct Line {
12    pub ai_id: i32,
13}
14
15impl Line {
16    pub fn add(&self, from: [f32; 3], to: [f32; 3]) -> Result<(), String> {
17        let mut command_c_data = AddLineDrawCommandData { to, from }.c_data();
18
19        handle_command(
20            self.ai_id,
21            COMMAND_TO_ID_ENGINE,
22            -1,
23            CommandTopic::DrawerLineAdd.into(),
24            &mut command_c_data,
25        )?;
26
27        Ok(())
28    }
29}