skyway_webrtc_gateway_api/
lib.rs

1/// common fields
2pub mod common;
3/// /data api bindings
4pub mod data;
5/// Definition of errors occur in this crate
6pub mod error;
7/// helper to load yaml
8pub(crate) mod helper;
9/// /media api bindings
10pub mod media;
11/// /peers api bindings
12pub mod peer;
13/// A "prelude" for users of this crate.
14pub mod prelude;
15
16use std::sync::Once;
17
18static mut BASE_URL: String = String::new();
19static INIT: Once = Once::new();
20static INIT_CHECK: Once = Once::new();
21
22/// Initialize this crate with base url of WebRTC Gateway.
23pub fn initialize(base_url: impl Into<String>) {
24    unsafe {
25        INIT.call_once(|| {
26            BASE_URL = base_url.into();
27        });
28    }
29}
30
31//use crate::common::{MyId, MySocket, PhantomId};
32pub(crate) fn base_url() -> &'static str {
33    unsafe {
34        INIT_CHECK.call_once(|| {
35            if BASE_URL.len() == 0 {
36                panic!("not initialized");
37            }
38        });
39        &BASE_URL
40    }
41}