blob: 07f5de6781a676d0cd2c7d8f37e6f384cbbfd451 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
const c = @import("c");
const zpy = @import("../root.zig");
pub const Fast = extern struct {
const Self = @This();
data: c.PyObject,
pub fn size(self: *Self) !usize {
return @intCast(c.PySequence_Fast_GET_SIZE(@ptrCast(self)));
}
pub fn get(self: *Self, index: usize) *zpy.Object {
return @ptrCast(c.PySequence_Fast_GET_ITEM(@ptrCast(self), @intCast(index)) orelse return error.Exception);
}
pub fn items(self: *Self) [*:null][*c]zpy.Object {
return @ptrCast(c.PySequence_Fast_ITEMS(@ptrCast(self)));
}
};
|