toString
Returns a string representation of the date.
Parameters
- self:PlainDate
- PlainDate
- allocator:std.mem.Allocator
- std.mem.Allocator
- options:ToStringOptions
- ToStringOptions
Source
Implementation
pub fn toString(self: PlainDate, allocator: std.mem.Allocator, options: ToStringOptions) ![]u8 {
var write = abi.DiplomatWrite.init(allocator);
defer write.deinit();
const display_cal: abi.c.DisplayCalendar = if (options.calendar_id) |cal| switch (cal) {
.auto => @intCast(abi.c.DisplayCalendar_Auto),
.always => @intCast(abi.c.DisplayCalendar_Always),
.never => @intCast(abi.c.DisplayCalendar_Never),
.critical => @intCast(abi.c.DisplayCalendar_Critical),
} else @intCast(abi.c.DisplayCalendar_Auto);
abi.c.temporal_rs_PlainDate_to_ixdtf_string(self._inner, display_cal, &write.inner);
return try write.toOwnedSlice();
}