volt_ws_protocol/
lib.rs

1use std::ptr;
2pub mod binary_message;
3pub mod constant;
4pub mod crypto_utils;
5pub mod rpc;
6pub mod rpc_manager;
7pub mod volt_client_configuration;
8pub mod volt_configuration;
9pub mod volt_credential;
10
11type LoggerFn = fn(&str);
12
13static mut LOGGER: *mut LoggerFn = ptr::null_mut();
14
15pub fn set_logger(logger: LoggerFn) {
16    unsafe {
17        LOGGER = Box::into_raw(Box::new(logger));
18    }
19}
20
21pub fn log(message: &str) {
22    unsafe {
23        if !LOGGER.is_null() {
24            (*LOGGER)(message);
25        }
26    }
27}