Something went wrong. Try again.
Zig parser for the OSM PBF file format. jeff.jcollie.pages/osm.zig
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie// SPDX-License-Identifier: MIT
const WayIterator = @This();
const std = @import("std");
const OSMPBF = @import("proto/OSMPBF.pb.zig");
const Way = @import("Way.zig");
block: *const OSMPBF.PrimitiveBlock,group: *const OSMPBF.PrimitiveGroup,index: usize,
pub fn init(block: *const OSMPBF.PrimitiveBlock, group: *const OSMPBF.PrimitiveGroup) WayIterator { return .{ .block = block, .group = group, .index = 0, };}
pub fn next(self: *WayIterator, gpa: std.mem.Allocator) !?Way { if (self.index >= self.group.ways.items.len) return null;
const way = &self.group.ways.items[self.index]; self.index += 1;
return try .init(gpa, self.block, way);}