#![doc = include_str!("../README.md")]
pub use smart_default;
pub use once_cell;
pub use parking_lot;
pub mod std_prelude {
pub use std::path::{Path, PathBuf};
pub use std::fs;
pub use std::io;
pub use std::thread;
pub use std::collections::{HashMap, BTreeMap, HashSet, BTreeSet};
pub use std::sync::Arc;
pub use std::sync::atomic::*;
pub use std::error::Error;
pub use std::borrow::Cow;
pub use std::time::{Duration, Instant};
pub use std::mem;
pub use std::fmt;
pub use std::env;
pub use std::process;
pub use std::any::*;
pub use std::f32::consts::{
PI,
FRAC_PI_2,
FRAC_PI_3,
FRAC_PI_4,
FRAC_PI_6,
FRAC_PI_8,
};
pub use std::f64::consts::{
PI as PI_F64,
FRAC_PI_2 as FRAC_PI_2_F64,
FRAC_PI_3 as FRAC_PI_3_F64,
FRAC_PI_4 as FRAC_PI_4_F64,
FRAC_PI_6 as FRAC_PI_6_F64,
FRAC_PI_8 as FRAC_PI_8_F64,
};
}
pub mod prelude {
pub use crate::flat;
pub use crate::io_add_msg;
pub use crate::ShortToString;
pub use once_cell::sync::Lazy;
pub use parking_lot::{Mutex, MutexGuard, MappedMutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard, MappedRwLockReadGuard};
pub use smart_default::*;
}
#[macro_export]
macro_rules! flat {
{$($(#[$attr:meta])* $name:ident ;)*} => {
$( $(#[$attr])* mod $name; $(#[$attr])* pub use self::$name::*; )*
};
}
#[macro_export]
macro_rules! io_add_msg {
($($msg:tt)+) => {
|err| std::io::Error::new(err.kind(), format!("{} {err}", format!($($msg)+)))
};
}
pub trait ShortToString {
fn s(&self) -> String;
}
impl ShortToString for str {
#[inline]
fn s(&self) -> String {
self.to_owned()
}
}
impl ShortToString for std::ffi::OsStr {
#[inline]
fn s(&self) -> String {
self.to_string_lossy().to_string()
}
}
impl ShortToString for std::path::Path {
#[inline]
fn s(&self) -> String {
self.to_string_lossy().to_string()
}
}
impl ShortToString for std::ffi::CStr {
#[inline]
fn s(&self) -> String {
self.to_string_lossy().to_string()
}
}
#[inline]
pub fn default<T: Default>() -> T {
T::default()
}