use core::fmt;
#[derive(Clone, Default)]
pub struct Backtrace {
_priv: (),
}
impl Backtrace {
#[must_use]
#[inline]
pub const fn is_captured(&self) -> bool {
false
}
}
impl crate::Capturable for Backtrace {
#[inline]
fn capture() -> Self {
Self { _priv: () }
}
#[inline]
fn capture_or_extract(source: &dyn crate::Diagnostic) -> Self {
match source.oopsie_backtrace() {
Some(trace) if trace.is_captured() => trace.clone(),
_ => Self::capture(),
}
}
}
impl fmt::Debug for Backtrace {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("<backtrace unavailable (no_std)>")
}
}
impl fmt::Display for Backtrace {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
Ok(())
}
}
#[doc(hidden)]
#[derive(Debug, Clone, Default)]
pub struct TraceMarker;
#[doc(hidden)]
#[must_use]
#[inline]
pub const fn set_marker() -> Option<TraceMarker> {
None
}
#[doc(hidden)]
#[inline]
pub const fn restore_marker(_prev: Option<TraceMarker>) {}