diff --git a/core/embed/rust/src/ui/macros.rs b/core/embed/rust/src/ui/macros.rs index 8ccea9d9c8..c0e239e9e7 100644 --- a/core/embed/rust/src/ui/macros.rs +++ b/core/embed/rust/src/ui/macros.rs @@ -4,3 +4,23 @@ macro_rules! include_res { include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/ui/", $filename)) }; } + +#[allow(unused_macros)] // Only used in TR so far. +/// Concatenates arbitrary amount of slices into a String. +macro_rules! build_string { + ($max:expr, $($string:expr),+) => { + { + let mut new_string = String::<$max>::new(); + $(unwrap!(new_string.push_str($string));)+ + new_string + } + } +} + +#[cfg(feature = "ui_debug")] +/// Transforms integer into string slice. For example for printing. +macro_rules! inttostr { + ($int:expr) => {{ + heapless::String::<10>::from($int).as_str() + }}; +}