nil_ffi/client.rs
1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use crate::queue::push_event;
5use futures::future::BoxFuture;
6use nil_client::Client;
7use nil_core::event::Event;
8use std::sync::LazyLock;
9use tokio::sync::RwLock;
10
11pub(crate) static CLIENT: LazyLock<RwLock<Client>> = LazyLock::new(RwLock::default);
12
13pub(crate) fn on_event() -> impl Fn(Event) -> BoxFuture<'static, ()> {
14 move |event: Event| Box::pin(async move { push_event(&event) })
15}