Function mycelium_util::fmt::alt

source ·
pub fn alt<T: Debug>(value: T) -> DebugValue<FormatWith<T>>
Expand description

Format the provided value using its core::fmt::Debug implementation, with “alternate mode” set

Examples

use mycelium_util::fmt;
use tracing::debug;

#[derive(Debug)]
struct Thing {
    question: &'static str,
    answer: usize,
}
let thing = Thing {
    question: "life, the universe, and everything",
    answer: 42,
};

debug!(something = ?thing);             // will be formatted on the current line
debug!(something = fmt::alt(&thing)); // will be formatted with newlines and indentation