1mod macros;
2
3yazi_macro::mod_pub!(ember spark);
4
5yazi_macro::mod_flat!(client payload pubsub pump sendable server state stream);
6
7pub fn init() {
8 let (tx, rx) = tokio::sync::mpsc::unbounded_channel();
9
10 ID.init(yazi_boot::ARGS.client_id.unwrap_or(yazi_shared::Id::unique()));
12 PEERS.with(<_>::default);
13 QUEUE_TX.init(tx);
14 QUEUE_RX.init(rx);
15
16 CLIENTS.with(<_>::default);
18 STATE.with(<_>::default);
19
20 LOCAL.with(<_>::default);
22 REMOTE.with(<_>::default);
23
24 unsafe {
26 if let Some(s) = std::env::var("YAZI_ID").ok().filter(|s| !s.is_empty()) {
27 std::env::set_var("YAZI_PID", s);
28 }
29 std::env::set_var("YAZI_ID", ID.to_string());
30 std::env::set_var(
31 "YAZI_LEVEL",
32 (std::env::var("YAZI_LEVEL").unwrap_or_default().parse().unwrap_or(0u16) + 1).to_string(),
33 );
34 }
35}
36
37pub fn serve() {
38 Pump::serve();
39 Client::serve();
40}
41
42pub async fn shutdown() { Pump::shutdown().await; }