mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
improve benchmarking error output (#7863)
* add concat Vec<u8> function and use it for better error logging in add_benchmark! macro * refactor benchmark error reporting to use format! and RuntimeString
This commit is contained in:
@@ -32,6 +32,22 @@ pub enum RuntimeString {
|
||||
Owned(Vec<u8>),
|
||||
}
|
||||
|
||||
/// Convenience macro to use the format! interface to get a `RuntimeString::Owned`
|
||||
#[macro_export]
|
||||
macro_rules! format_runtime_string {
|
||||
($($args:tt)*) => {{
|
||||
#[cfg(feature = "std")]
|
||||
{
|
||||
sp_runtime::RuntimeString::Owned(format!($($args)*))
|
||||
}
|
||||
#[cfg(not(feature = "std"))]
|
||||
{
|
||||
sp_runtime::RuntimeString::Owned(sp_std::alloc::format!($($args)*).as_bytes().to_vec())
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
|
||||
impl From<&'static str> for RuntimeString {
|
||||
fn from(data: &'static str) -> Self {
|
||||
Self::Borrowed(data)
|
||||
|
||||
Reference in New Issue
Block a user