AppFlowy/rust-lib/flowy-sys/tests/api/helper.rs

23 lines
519 B
Rust
Raw Normal View History

use flowy_sys::prelude::*;
use std::{cell::RefCell, sync::Once};
2021-06-27 07:11:41 +00:00
#[allow(dead_code)]
pub fn setup_env() {
static INIT: Once = Once::new();
INIT.call_once(|| {
std::env::set_var("RUST_LOG", "flowy_sys=debug,debug");
2021-06-27 07:11:41 +00:00
env_logger::init();
});
}
2021-07-03 06:14:10 +00:00
pub async fn async_send(request: DispatchRequest) -> EventResponse {
EventDispatch::async_send(request).await
}
2021-07-03 06:14:10 +00:00
pub fn init_dispatch<F>(module_factory: F)
where
F: FnOnce() -> Vec<Module>,
{
2021-07-03 06:14:10 +00:00
EventDispatch::construct(module_factory);
}