const std = @import("std"); // Export all public types and functions pub const PiFinder = @import("pi_finder.zig").PiFinder; pub const ContextConfig = @import("pi_finder.zig").ContextConfig; pub const SearchResult = @import("pi_finder.zig").SearchResult; // JSON utility functions for easier usage pub fn formatSearchResultAsJson(allocator: std.mem.Allocator, result: SearchResult) ![]u8 { var json_string = std.ArrayList(u8).init(allocator); try std.json.stringify(result, .{}, json_string.writer()); return json_string.toOwnedSlice(); } // Plain text utility functions for easier usage pub fn formatSearchResultAsPlainText(allocator: std.mem.Allocator, result: SearchResult) ![]u8 { var plain_text = std.ArrayList(u8).init(allocator); var writer = plain_text.writer(); try writer.writeAll("Success: "); try writer.print("{}\n", .{result.success}); try writer.writeAll("Sequence: "); try writer.writeAll(result.sequence); if (result.position) |pos| { try writer.writeAll("\nPosition: "); try writer.print("{d}", .{pos}); } else { try writer.writeAll("\nPosition: N/A"); } if (result.context) |context| { try writer.writeAll("\nContext: "); try writer.writeAll(context); } else { try writer.writeAll("\nContext: N/A"); } if (result.error_message) |err_msg| { try writer.writeAll("\nError Message: "); try writer.writeAll(err_msg); } return plain_text.toOwnedSlice(); }