const std = @import("std"); const print = std.debug.print; const pretty_mod = @import("pretty"); const pretty = pretty_mod.pretty; const Pretty = pretty_mod.PrettyWithOptions; pub const pretty_options = pretty_mod.Options{ .always_show_type_names = true }; const Hello = enum { world, developer }; const Gender = enum(u8) { male, female, nonbinary, other, _ }; const Person = struct { age: u8, gender: ?Gender, }; const Nested = struct { a: ChildA, b: ChildB, }; const ChildA = struct { child: ChildC, }; const ChildB = struct { hello: Hello, }; const ChildC = struct { person: Person, }; pub fn main(init: std.process.Init) !void { _ = init; print("Pretty type - {f}\n", .{pretty(Hello)}); print("Pretty null - {f}\n", .{pretty(null)}); print("\nBooleans\n", .{}); print("Boolean true - {f}\n", .{pretty(true)}); print("Boolean false - {f}\n", .{pretty(false)}); print( "Boolean true always with type name - {f}\n", .{Pretty(bool, .{ .always_show_type_names = true, .theme = .{ .type_value_sep = ": " }, }).init(true)}, ); print("\nUnsigned Integers\n", .{}); print("Pretty u8 - {f}\n", .{pretty(@as(u8, 42))}); print("Pretty u16 - {f}\n", .{pretty(@as(u16, 42))}); print("Pretty u32 - {f}\n", .{pretty(@as(u32, 42))}); print("Pretty u64 - {f}\n", .{pretty(@as(u64, 42))}); print("Pretty usize - {f}\n", .{pretty(@as(usize, 42))}); print("\nSigned Integers\n", .{}); print("Pretty comptime_int - {f}\n", .{pretty(42)}); print("Pretty i8 - {f}\n", .{pretty(@as(i8, 42))}); print("Pretty i16 - {f}\n", .{pretty(@as(i16, 42))}); print("Pretty i32 - {f}\n", .{pretty(@as(i32, 42))}); print("Pretty i64 - {f}\n", .{pretty(@as(i64, 42))}); print("Pretty isize - {f}\n", .{pretty(@as(isize, 42))}); print("\nFloats\n", .{}); print("Pretty comptime_float - {f}\n", .{pretty(3.131)}); print("Pretty f16 - {f}\n", .{pretty(@as(f16, 3.141))}); print("Pretty f32 - {f}\n", .{pretty(@as(f32, 3.141))}); print("Pretty f64 - {f}\n", .{pretty(@as(f64, 3.141))}); print("\nEnums\n", .{}); print("Pretty enum - {f}\n", .{pretty(Hello.world)}); print("Pretty enum literal - {f}\n", .{pretty(.hello_world)}); const opt_null: ?Hello = null; const opt_not_null: ?Hello = .developer; print("\nOptionals\n", .{}); print("Pretty optional = null - {f}\n", .{pretty(opt_null)}); print("Pretty optional = not null - {f}\n", .{pretty(opt_not_null)}); const person = Person{ .age = 13, .gender = null }; const nested = Nested{ .a = .{ .child = .{ .person = person } }, .b = .{ .hello = .world }, }; print("\nStructs\n", .{}); print("Pretty simple struct - {f}\n", .{pretty(person)}); print( "Pretty simple inlined struct - {f}\n", .{Pretty(Person, .{ .inline_structs = true }).init(person)}, ); print("Pretty nested struct - {f}\n", .{pretty(nested)}); }