era
Returns the era for this date-time, if any.
Parameters
- self:PlainDateTime
- PlainDateTime
- allocator:std.mem.Allocator
- std.mem.Allocator
Source
Implementation
pub fn era(self: PlainDateTime, allocator: std.mem.Allocator) !?[]u8 {
var write = abi.DiplomatWrite.init(allocator);
defer write.deinit();
abi.c.temporal_rs_PlainDateTime_era(self._inner, &write.inner);
const result = try write.toOwnedSlice();
if (result.len == 0) {
allocator.free(result);
return null;
}
return result;
}