forked from AbleOS/ableos
28 lines
934 B
Rust
28 lines
934 B
Rust
//! A module for small utilities to be used kernel wide
|
|
//! Simple functions and constants
|
|
|
|
/// Used when tab `\t` in hardware is not known and we will default to two spaces
|
|
pub const TAB: &str = " ";
|
|
|
|
|
|
// NOTE: this only reduces the code duplication in source code not in generated code!
|
|
// Written by Yours Truly: Munir
|
|
/// A simple macro to reduce code duplication when we use TAB internally
|
|
#[macro_export]
|
|
macro_rules! tab {
|
|
($num:expr) => {
|
|
TAB.repeat($num)
|
|
}
|
|
}
|
|
|
|
// NOTE: this only reduces the code duplication in source code not in generated code!
|
|
// Written by Yours Truly: Munir
|
|
/// A simple macro to reduce code duplication when we insert device types into the device tree
|
|
#[macro_export]
|
|
macro_rules! device_tree {
|
|
($devtree:expr, $dev_type_vec:expr) => {
|
|
for each_device_type in $dev_type_vec {
|
|
$devtree.devices.insert(each_device_type.to_string(), Vec::new());
|
|
}
|
|
};
|
|
} |