pub use pstd::{
Box, String, Vec,
collections::btree_map::CustomTuning,
collections::{BTreeMap, DefaultHashBuilder, HashMap},
localalloc::{Local, Temp},
rc::{Rc, RcStr},
};
pub type TBox<T> = Box<T, Temp>;
pub fn tbox<T>(t: T) -> TBox<T> {
TBox::new_in(t, Temp::new())
}
pub type TVec<T> = Vec<T, Temp>;
pub fn tvec<T>() -> TVec<T> {
TVec::new_in(Temp::new())
}
pub type LBox<T> = Box<T, Local>;
pub fn lbox<T>(t: T) -> LBox<T> {
LBox::new_in(t, Local::new())
}
pub type LRc<T> = Rc<T, Local>;
pub type LRcStr = RcStr<Local>;
pub fn lrc<T>(t: T) -> LRc<T> {
LRc::new_in(t, Local::new())
}
pub fn lrcstr(s: &str) -> LRcStr {
LRcStr::new_in(s, Local::new())
}
pub type LVec<T> = Vec<T, Local>;
pub fn lvec<T>() -> LVec<T> {
LVec::new_in(Local::new())
}
pub fn lvec_with_capacity<T>(capacity: usize) -> LVec<T> {
LVec::with_capacity_in(capacity, Local::new())
}
pub type LBTreeMap<K, V> = BTreeMap<K, V, CustomTuning<Local>>;
pub fn lbtreemap<K, V>() -> LBTreeMap<K, V> {
LBTreeMap::with_tuning(CustomTuning::default())
}
pub type LHashMap<K, V> = HashMap<K, V, DefaultHashBuilder, Local>;
pub fn lhashmap<K, V>() -> LHashMap<K, V> {
LHashMap::new_in(Local::new())
}
#[cfg(feature = "dynbox")]
pub type DBox<T> = LBox<T>;
#[cfg(not(feature = "dynbox"))]
pub type DBox<T> = std::boxed::Box<T>;
#[cfg(feature = "dynbox")]
pub fn dbox<T>(t: T) -> LBox<T> {
LBox::new_in(t, Local::new())
}
#[cfg(not(feature = "dynbox"))]
pub fn dbox<T>(t: T) -> std::boxed::Box<T> {
std::boxed::Box::new(t)
}
pub type LString = String<Local>;
pub fn lstring(s: &str) -> LString {
String::from_str_in(s, Local::new())
}
pub fn lboxstr(s: &str) -> LBox<str> {
LBox::<str>::from_str_in(s, Local::new())
}
pub fn tboxstr(s: &str) -> TBox<str> {
TBox::<str>::from_str_in(s, Temp::new())
}