#How to print nested struct of ArrayList ?
1 messages · Page 1 of 1 (latest)
code coming
so basically, is there an easy way in Zig to print that
const CSSBlock = struct { selectors: std.ArrayList(Selector), body: std.ArrayList([]PropertyValue) };
const AST = struct {
ast: std.ArrayList(CSSBlock),
};
Id like when printing ast to have like
{
},
{
}
kind of in a JSON manners if that makes any sense ?
if that is even possible
youd just loop over the items in the AST arraylist
and then print the items in the selectors and body arraylists and all that
title is also wrong I have a struct with an ArrayList with the type of another struct
I dont get what youre confused on
I thought thought there would be a method kind of stuff
u know JS and console.log printing about anything
but ok Ill do this then thx !
you can with the normal print functions
the issue is that it doesnt know the right way to print strings, it can either print them as numbers or characters
and your ArrayLists have an Allocator which would be printed
etc
it would just be really messy
and also to make it a lot simpler, it won’t pretty print it, i.e itll all be on one line
which makes it pretty much unreadable for stuff like this
I think they are asking about the "format" function
@normal furnace hmhm probably idk