aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/libghostty-vt/src/lib/types.zig
blob: 01052249690dcb999d3323c39e5b7cda30f8d370 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
pub const String = extern struct {
    ptr: [*]const u8,
    len: usize,

    pub fn init(zig: anytype) String {
        return switch (@TypeOf(zig)) {
            []u8, []const u8 => .{
                .ptr = zig.ptr,
                .len = zig.len,
            },
            else => @compileError("unsupported String.init type: " ++ @typeName(@TypeOf(zig))),
        };
    }
};

pub const Buffer = extern struct {
    ptr: ?[*]u8 = null,
    cap: usize = 0,
    len: usize = 0,
};