moon run cmd/main{
"import": [{ "path": "moonbit-community/debug", "alias": "dbg" }]
}///|
fn show_examples {
println(@dbg.pretty_print([1, 2, 3]))
println(@dbg.pretty_print_diff(Some(1), Some(2)))
}///|
struct Person {
name : String
age : Int
}
///|
pub impl @dbg.Debug for Person with debug(self) {
@dbg.record([("name", @dbg.debug(self.name)), ("age", @dbg.debug(self.age))])
}{
"pre-build": [
{
"command": "$mod_dir/.mooncakes/moonbit-community/debug_deriving/debug_deriving $input $output",
"input": "input.mbt",
"output": "output.mbt"
}
]
}///|
#debugderive
struct Pos(Int, Int)///|
test {
inspect(pretty_print([1, 2, 3]), content="[1, 2, 3]")
inspect(
pretty_print_diff(1, 2, compact_threshold=100, use_ansi=false),
content="-1 +2",
)
}impl Debug for FixedArray[T]impl Debug for ReadOnlyArray[T]impl Debug for MutArrayView[T]impl Debug for PriorityQueue[A]fn[A : Debug, B : Debug, C : Debug, D : Debug, E : Debug, F : Debug, G : Debug, H : Debug, I : Debug, J : Debug, K : Debug, L : Debug, M : Debug, N : Debug, O : Debug, P : Debug, Q : Debug, R : Debug, S : Debug, T : Debug] debug(self : (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)) -> Reprfn[A : Debug, B : Debug, C : Debug, D : Debug, E : Debug, F : Debug, G : Debug, H : Debug, I : Debug, J : Debug, K : Debug, L : Debug, M : Debug, N : Debug, O : Debug, P : Debug, Q : Debug, R : Debug, S : Debug, T : Debug, U : Debug] debug(self : (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)) -> Reprfn[A : Debug, B : Debug, C : Debug, D : Debug, E : Debug, F : Debug, G : Debug, H : Debug, I : Debug, J : Debug, K : Debug, L : Debug, M : Debug, N : Debug, O : Debug, P : Debug, Q : Debug, R : Debug, S : Debug, T : Debug, U : Debug, V : Debug] debug(self : (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)) -> Reprimpl Debug for StringViewfn[T : Debug] pretty_print(x : T, max_depth? : Int, compact_threshold? : Int, use_ansi? : Bool) -> Stringfn pretty_print_delta(d : ReprDelta, max_depth? : Int, compact_threshold? : Int, use_ansi? : Bool) -> Stringfn[T : Debug] pretty_print_diff(x : T, y : T, max_depth? : Int, compact_threshold? : Int, use_ansi? : Bool, max_relative_error? : Double) -> Stringfn pretty_print_repr(r : Repr, max_depth? : Int, compact_threshold? : Int, use_ansi? : Bool) -> String