blob: 5877d12479e816860962d8991c831bf3476fa791 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
const c = @import("c");
const zpy = @import("root.zig");
const conversion = zpy.conversion;
const Self = @This();
object: zpy.Object,
pub fn from(value: f64) !Self {
return .{
.object = .fromPtr(try conversion.ptr(c.PyFloat_FromDouble(value))),
};
}
pub fn asDouble(self: *const Self) f64 {
return c.PyFloat_asDouble(self.object.ptr);
}
pub fn deinit(self: *Self) void {
self.object.decref();
}
|