Hi! I wonder how to print a struct in a human readable format
const Response = struct {
products: struct {
id: i32,
title: u8,
description: u8,
images: u8,
},
};
Which I print like this
for (response.products) |product| {
print("{any}\n", .{product});
}
and get the following output from
main.Response.Response__struct_6372{ .id = 1, .title = { 105, 80, 104, 111, 110, 101, 32, 57 }, .description = { 65, 110, 32, 97, 112, 112, 108, 101, 32, 109, 111, 98, 105, 108, 101, 32, 11
9, 104, 105, 99, 104, 32, 105, 115, 32, 110, 111, 116, 104, 105, 110, 103, 32, 108, 105, 107, 101, 32, 97, 112, 112, 108, 101 }, .images = { { 104, 116, 116, 112, 115, 58, 47, 47, 105, 46,
100, 117, 109, 109, 121, 106, 115, 111, 110, 46, 99, 111, 109, 47, 100, 97, 116, 97, 47, 112, 114, 111, 100, 117, 99, 116, 115, 47, 49, 47, 49, 46, 106, 112, 103 }, { 104, 116, 116, 112, 11
5, 58, 47, 47, 105, 46, 100, 117, 109, 109, 121, 106, 115, 111, 110, 46, 99, 111, 109, 47, 100, 97, 116, 97, 47, 112, 114, 111, 100, 117, 99, 116, 115, 47, 49, 47, 50, 46, 106, 112, 103 },
{ 104, 116, 116, 112, 115, 58, 47, 47, 105, 46, 100, 117, 109, 109, 121, 106, 115, 111, 110, 46, 99, 111, 109, 47, 100, 97, 116, 97, 47, 112, 114, 111, 100, 117, 99, 116, 115, 47, 49, 47, 5
1, 46, 106, 112, 103 }, { 104, 116, 116, 112, 115, 58, 47, 47, 105, 46, 100, 117, 109, 109, 121, 106, 115, 111, 110, 46, 99, 111, 109, 47, 100, 97, 116, 97, 47, 112, 114, 111, 100, 117, 99,
116, 115, 47, 49, 47, 52, 46, 106, 112, 103 }, { 104, 116, 116, 112, 115, 58, 47, 47, 105, 46, 100, 117, 109, 109, 121, 106, 115, 111, 110, 46, 99, 111, 109, 47, 100, 97, 116, 97, 47, 112,
114, 111, 100, 117, 99, 116, 115, 47, 49, 47, 116, 104, 117, 109, 98, 110, 97, 105, 108, 46, 106, 112, 103 } } }
Can I tell print to print u8 inside a struct as a string, not as a list of u8 without adding a custom formatter?