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) {