Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/cranelift/codegen/src/dbg.rs
1693 views
1
//! Debug tracing helpers.
2
use core::fmt;
3
4
/// Prefix added to the log file names, just before the thread name or id.
5
pub static LOG_FILENAME_PREFIX: &str = "cranelift.dbg.";
6
7
/// Helper for printing lists.
8
pub struct DisplayList<'a, T>(pub &'a [T])
9
where
10
T: 'a + fmt::Display;
11
12
impl<'a, T> fmt::Display for DisplayList<'a, T>
13
where
14
T: 'a + fmt::Display,
15
{
16
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17
match self.0.split_first() {
18
None => write!(f, "[]"),
19
Some((first, rest)) => {
20
write!(f, "[{first}")?;
21
for x in rest {
22
write!(f, ", {x}")?;
23
}
24
write!(f, "]")
25
}
26
}
27
}
28
}
29
30