From 0c6719d70ffd881bd85741d7c78a2528a91460da Mon Sep 17 00:00:00 2001 From: Altagos Date: Thu, 19 Feb 2026 16:44:59 +0100 Subject: [PATCH] custom inline printing --- pretty.zig | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pretty.zig b/pretty.zig index 5afcb54..c953d10 100644 --- a/pretty.zig +++ b/pretty.zig @@ -208,6 +208,7 @@ pub const Context = struct { pub const InnerFmtOptions = struct { skip_type_name: bool = !default_options.show_type_names, + force_inline: bool = false, }; fn innerFmt( @@ -222,8 +223,14 @@ fn innerFmt( if (!opts.skip_type_name) try printType(T, ctx, run, value); - if (std.meta.hasMethod(T, "pretty")) { - return value.pretty(ctx, run); + if (ctx.options.struct_inline or opts.force_inline) { + if (std.meta.hasMethod(T, "prettyInline")) { + return value.prettyInline(ctx, run); + } + } else { + if (std.meta.hasMethod(T, "pretty")) { + return value.pretty(ctx, run); + } } return switch (info) { -- 2.51.2