flesh 0.0.12

Flora's LowRes Extensible Super Highway
pub mod events;
pub mod mesh;
pub mod modes;
pub mod transport;

pub use {
    modes::*,
    transport::{encoding::FLESHMessage, network::Network},
};

#[macro_export]
/// Point FLESH to the entry for the app. <br>
/// The signature needs to be (Network, usize), and should be async.
macro_rules! flesh_module {
    ($fun: ident) => {
        #[unsafe(no_mangle)]
        pub extern "C" fn __flesh_entrypoint(network: *mut std::ffi::c_void, port: usize) {
            let network = unsafe { &*(network as *const ::flesh::Network) };
            let rt = ::tokio::runtime::Builder::new_multi_thread().enable_all().build().unwrap();
            let et = rt.enter();
            rt.block_on($fun(network.clone(), port));
            drop(et);
        }
    };
}