this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

get list_view example working

authored by

Jeffrey C. Ollie and committed by
Tim Culverhouse
afd3ebb2 273a0167

+8 -10
+8 -10
examples/list_view.zig
··· 52 52 } 53 53 }; 54 54 55 - pub fn main() !void { 56 - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; 57 - defer _ = gpa.deinit(); 55 + pub fn main(init: std.process.Init) !void { 56 + const io = init.io; 57 + const allocator = init.gpa; 58 58 59 - const allocator = gpa.allocator(); 60 - 61 - var app = try vxfw.App.init(allocator); 59 + var app: vxfw.App = undefined; 60 + try app.init(io, allocator, init.environ_map); 62 61 defer app.deinit(); 63 62 64 63 const model = try allocator.create(Model); 65 64 defer allocator.destroy(model); 66 65 67 66 const n = 80; 68 - var texts = try std.ArrayList(Widget).initCapacity(allocator, n); 69 - 70 - var allocs = try std.ArrayList(*Text).initCapacity(allocator, n); 67 + var texts: std.ArrayList(Widget) = try .initCapacity(allocator, n); 68 + var allocs: std.ArrayList(*Text) = try .initCapacity(allocator, n); 71 69 defer { 72 70 for (allocs.items) |tw| { 73 71 allocator.free(tw.text); ··· 78 76 } 79 77 80 78 for (0..n) |i| { 81 - const t = std.fmt.allocPrint(allocator, "List Item {d}", .{i}) catch "placeholder"; 79 + const t = std.fmt.allocPrint(allocator, "List Item {d} of {d}", .{ i, n }) catch "placeholder"; 82 80 const tw = try allocator.create(Text); 83 81 tw.* = .{ .text = t }; 84 82 _ = try allocs.append(allocator, tw);