corelib_rust/
lib.rs

1// =============================================
2// FILE: rust/src/lib.rs
3// PURPOSE: Core Rust FFI entry point + public modules
4// All original FFI functions and N-API exports are unchanged.
5// =============================================
6
7/// Public utils module (mirrors TS `utils` section).
8/// Contains internal helpers for future FFI functions (cron, etc.).
9pub mod utils;
10
11use napi_derive::napi;
12
13/// Logs a message in Rust and returns the input value doubled.
14/// Used by the TS FFI bridge (`logAndDouble`).
15#[napi]
16pub fn log_and_double(msg: String, value: i32) -> i32 {
17    println!("[Rust FFI] {}", msg);
18    value * 2
19}
20
21/// Returns the Cargo package version as a string.
22/// Used by the TS FFI bridge (`getVersion`).
23#[napi]
24pub fn get_version() -> String {
25    env!("CARGO_PKG_VERSION").to_string()
26}
27
28pub mod markets {
29    pub mod nasdaq {
30        pub mod datafeeds {
31            pub mod streaming {
32                pub mod yahoo {
33                    pub mod yahoo_streamer;
34                    pub mod yahoo_streaming_proto_handler;
35                    pub use yahoo_streamer::{
36                        EventRecord, LogRecord, RustCallbacks, YahooConfig, YahooStreaming,
37                        YahooStreamingCore,
38                    };
39                }
40            }
41        }
42    }
43}
44
45pub use markets::nasdaq::datafeeds::streaming::yahoo::{
46    EventRecord, LogRecord, RustCallbacks, YahooConfig, YahooStreaming, YahooStreamingCore,
47};