agentic_robotics_node/
lib.rs

1//! ROS3 Node.js Bindings
2//!
3//! NAPI bindings for Node.js integration
4
5#![deny(clippy::all)]
6
7use napi::bindgen_prelude::*;
8use napi_derive::napi;
9
10#[napi]
11pub struct ROS3Node {
12    name: String,
13}
14
15#[napi]
16impl ROS3Node {
17    #[napi(constructor)]
18    pub fn new(name: String) -> Self {
19        Self { name }
20    }
21
22    #[napi]
23    pub fn get_name(&self) -> String {
24        self.name.clone()
25    }
26
27    #[napi]
28    pub async fn publish(&self, topic: String, data: String) -> Result<()> {
29        // In real implementation, this would use ros3-core
30        Ok(())
31    }
32
33    #[napi]
34    pub fn get_version() -> String {
35        env!("CARGO_PKG_VERSION").to_string()
36    }
37}
38
39#[cfg(test)]
40mod tests {
41    use super::*;
42
43    #[test]
44    fn test_node_creation() {
45        let node = ROS3Node::new("test_node".to_string());
46        assert_eq!(node.get_name(), "test_node");
47    }
48}