#![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 id;
pub use id::*;
mod uniq;
pub use uniq::*;
mod url;
pub use crate::url::*;
mod evt;
pub use evt::*;
#[cfg(feature = "file_check")]
pub mod file_check;
pub mod wire;
pub mod ws {
pub const MAX_SEND_QUEUE: usize = 32;
pub const MAX_MESSAGE_SIZE: usize = 2048;
pub const MAX_FRAME_SIZE: usize = 2048;
}
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 ephemeral_udp_port_min: u16,
pub ephemeral_udp_port_max: u16,
}
impl Default for Tx5InitConfig {
fn default() -> Self {
Self {
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();