miniblink/
lib.rs

1#![doc = include_str!("../README.md")]
2#![warn(missing_docs)]
3
4mod util;
5
6/// Wraps to global functions.
7pub mod app;
8/// Defines the miniblink error types.
9pub mod error;
10/// Wraps to mbWebView.
11pub mod webview;
12
13use std::sync::OnceLock;
14
15use error::{MBError, MBResult};
16
17type MbLibrary = miniblink_sys::Library;
18
19pub(crate) static LIB: OnceLock<MbLibrary> = OnceLock::new();
20
21/// Call the inner api. Use it to call unwrapped api.
22pub fn call_api() -> MBResult<&'static MbLibrary> {
23    LIB.get().ok_or_else(|| MBError::NotInitialized)
24}
25
26pub(crate) fn call_api_or_panic() -> &'static MbLibrary {
27    call_api().unwrap()
28}