1pub mod bigint;
6pub mod bitbang;
7pub mod file;
8pub mod fs;
9pub mod hexdump;
10pub mod num_de;
11pub mod parse_int;
12pub mod present;
13pub mod printer;
14pub mod raw_tty;
15mod regex;
16pub mod rom_detect;
17pub mod runtime;
18pub mod serde;
19pub mod serializable_error;
20pub mod status;
21pub mod testing;
22pub mod usb;
23pub mod usr_access;
24pub mod vcd;
25pub mod vmem;
26pub mod voltage;
27
28pub use ot_hal::util::bitfield;
29
30pub use runtime::runtime;
31
32#[macro_export]
34macro_rules! collection {
35 ($($k:expr => $v:expr),* $(,)?) => {{
37 use std::iter::{Iterator, IntoIterator};
38 Iterator::collect(IntoIterator::into_iter([$(($k, $v),)*]))
39 }};
40
41 ($($v:expr),* $(,)?) => {{
43 use std::iter::{Iterator, IntoIterator};
44 Iterator::collect(IntoIterator::into_iter([$($v),*]))
45 }};
46}
47
48#[cfg(test)]
50pub fn testdata(test: &str) -> std::path::PathBuf {
51 let mut path: std::path::PathBuf = std::env::var_os("TESTDATA").unwrap().into();
52 path.pop();
54 path.pop();
55 path.push(test);
56 path
57}
58
59pub fn tmpfilename(name: &str) -> String {
63 let mut dir = match std::env::var("TEST_UNDECLARED_OUTPUTS_DIR") {
64 Ok(name) => std::path::PathBuf::from(name),
65 Err(_) => std::env::temp_dir(),
66 };
67 dir.push(name);
68 dir.to_str().unwrap().into()
69}