MPDR200011 commented on code in PR #3730: URL: https://github.com/apache/thrift/pull/3730#discussion_r3807898737
########## tutorial/zig/src/tutorial_client.zig: ########## @@ -0,0 +1,83 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +const std = @import("std"); +const thrift = @import("thrift"); +const tutorial = @import("tutorial"); + +const Allocator = std.mem.Allocator; + +pub fn main(init: std.process.Init) !void { + var debug_allocator: std.heap.DebugAllocator(.{}) = .init; + defer switch (debug_allocator.deinit()) { + .leak => std.debug.print("UNFREE'D MEMORY DETECTED!!!! CHECK YOUR ALLOCS!!! >:(\n", .{}), + .ok => std.debug.print("No memory leaks detected :)\n", .{}), + }; + const gpa = debug_allocator.allocator(); + var config = thrift.TConfiguration.default; + + var socket = try thrift.TSocket.initFromAddress(gpa, init.io, .{ .ip4 = .{ .bytes = [4]u8{0 ,0 ,0 ,0}, .port = 9069}}); Review Comment: > does this even work on client side? hm, surprisingly, it does on my machine. I'll change that to `127.0.0.1` to avoid confusion, though. > so `0, 0, 0, 0` over `0 ,0 ,0 ,0` good catch, looks like uncoordinated hands on my part ########## tutorial/zig/build.zig.zon: ########## @@ -0,0 +1,43 @@ +.{ + // This is the default name used by packages depending on this one. For + // example, when a user runs `zig fetch --save <url>`, this field is used + // as the key in the `dependencies` table. Although the user can choose a + // different name, most users will stick with this provided value. + // + // It is redundant to include "zig" in this name because it is already + // within the Zig package namespace. + .name = .zig, + // This is a [Semantic Version](https://semver.org/). + // In a future version of Zig it will be used for package deduplication. + .version = "0.0.0", Review Comment: I assume you mean the library version and not the tutorial? Is that a convention for other libraries? It would mean having to manually update this every time a new release of thrift comes out, which sounds like an easily missed chore. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
