const std = @import("std");

pub fn main() !void {
    // Why we need the conversion:

    // SQLite stores strings as C-style null-terminated strings
    const c_string: [*:0]const u8 = "Hello, World!";

    // But Zig functions expect slices (pointer + length)
    // For example, this function wants a slice:
    printText("Direct string");  // This works - string literals are slices

    // Can't do this - type mismatch:
    // printText(c_string);  // ERROR: expected []const u8, found [*:0]const u8

    // Must convert pointer to slice:
    const slice = std.mem.span(c_string);
    printText(slice);  // Now it works!

    // Our Highlight.init() is the same - it expects slices, not pointers
}

fn printText(text: []const u8) void {
    std.debug.print("Text: {s} (length: {})\n", .{text, text.len});
}
