#![deny(missing_docs)]
#![deny(unsafe_code)]
#![doc = include_str!("README.tpl")]
include!(concat!(env!("OUT_DIR"), "/readme.rs"));
pub mod deps {
pub use base64;
pub use serde;
pub use serde_json;
}
mod error;
pub use error::*;
mod evt;
pub use evt::*;
#[cfg(feature = "file_check")]
pub mod file_check;
pub type BoxFut<'lt, T> =
std::pin::Pin<Box<dyn std::future::Future<Output = T> + 'lt + Send>>;
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)]
#[serde(crate = "deps::serde", rename_all = "camelCase")]
pub struct Tx5InitConfig {
pub tracing_enabled: bool,
pub ephemeral_udp_port_min: u16,
pub ephemeral_udp_port_max: u16,
}
impl Default for Tx5InitConfig {
fn default() -> Self {
Self {
tracing_enabled: false,
ephemeral_udp_port_min: 1,
ephemeral_udp_port_max: 65535,
}
}
}
impl Tx5InitConfig {
pub fn set_as_global_default(&self) -> Result<()> {
TX5_INIT_CONFIG
.set(*self)
.map_err(|_| Error::id("Tx5InitAlreadySet"))
}
pub fn get() -> Self {
*TX5_INIT_CONFIG.get_or_init(Tx5InitConfig::default)
}
}
static TX5_INIT_CONFIG: once_cell::sync::OnceCell<Tx5InitConfig> =
once_cell::sync::OnceCell::new();