grafix_toolbox/kit/
policies.rs

1pub mod ext {
2	pub use super::{func::file as FS, func::rand, func::slicing, pre::chksum::ref_UUID, pre::logging, profiling, types::lazy, types::prefetch};
3}
4
5pub mod pre {
6	pub use super::func::{chksum, ext::*, index::*, logging, n_iter::*, result::*, vec::*};
7	pub use super::types::{cached::*, cached_str::*, ext::*, memoized::MemRes, memoized::Memoized};
8	pub use super::{math::pre::*, traits::*};
9
10	pub type STR = &'static str;
11	pub type Str = Box<str>;
12	pub type Astr = std::sync::Arc<str>;
13
14	pub fn Box<T>(v: T) -> Box<T> {
15		Box::new(v)
16	}
17	pub fn Cell<T>(v: T) -> std::cell::Cell<T> {
18		std::cell::Cell::new(v)
19	}
20	pub fn Def<T: Default>() -> T {
21		Default::default()
22	}
23
24	pub fn type_name<T: ?Sized>() -> String {
25		let mut str = std::any::type_name::<T>()
26			.split('<')
27			.map(|s| [s.split("::").last().unwrap_or(""), "<"].concat())
28			.collect::<String>();
29		str.pop();
30		str
31	}
32}
33
34#[macro_export]
35macro_rules! map_variant {
36	($t: pat = $e: expr => $do: expr) => {{
37		if let $t = $e {
38			Some($do)
39		} else {
40			None
41		}
42	}};
43}
44
45#[macro_use]
46mod traits;
47#[macro_use]
48mod func;
49#[macro_use]
50mod types;
51
52pub mod math;
53pub mod profiling;
54pub mod task;