Skip to content

Conversation

@zigster64
Copy link
Contributor

Not submitting this as an actual PR - just using it as a reference for comparisons, in case that helps.

A number of small (but annoying) changes Ive made on top of master to get it compiling and running all the examples bug-free. Do check example_01 as well - it may build, but it will crash on posting the form if you keep std.fmt.format() in the execution path

In all my applications, I make liberal use of this pattern that I would prefer to keep using :

w = res.writer() and then rely on w.print(fmtstring, args) all over the place

Trying hard to avoid using &w.interface as a substitute, doesnt look or feel good at all

Also trying hard to avoid std.fmt.format(), because this calls adaptToNewApi() or something, which in turn gives us back a res.Writer() that has a NULL res ... which then starts a world of problems (see example_01 -> submit form = segfault trying to deref the NULL Writer.res value

src/response.zig Outdated

fn print(self: Writer, comptime format: []const u8, args: anytype) Allocator.Error!void {
return std.fmt.format(self, format, args);
pub fn print(self: Writer, comptime format: []const u8, args: anytype) Allocator.Error!void {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternative - change the error return type to match std.Io.Writer.Error type

karlseguin added a commit that referenced this pull request Aug 24, 2025
@karlseguin
Copy link
Owner

Thanks, this was useful. But I did adopt the:

var w = res.writer;
whatever(&w.interface);

pattern, I also think it's clunky (but, actually, the least clunky part of this whole new API), but I don't think it's useful to avoid it in a library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants