3 ms·
Yeah I think mine is more about being able to provide a `host()` helper function instead of a `.get(.host)` meta function. It is somewhat boilerplate-y. I think
by atmikemikeb 1y ago
Yeah I think mine is more about being able to provide a `host()` helper function instead of a `.get(.host)` meta function. It is somewhat boilerplate-y. I think it's really a matter of taste haha. Likely yours would be useful regardless if this is done a lot, since it abstracts some of it, if one wants that.
- rvrb 1y agoI've entertained further expanding this API to expose a comptime generated struct of pointers. From the Connection use-case detailed in the article, it would look something like this: pub fn getPtrs(self: Self) struct { client: *Client, host: []u8, read_buffer: []u8, write_buffer: []u8, } { return .{ client: self.get(.client), host: self.get(.host), read_buffer: self.get(.read_buffer), write_buffer: self.get(.write_buffer), } } I haven't done this because I'm not yet convinced it's worth the added complexity