Function utf8EncodeComptime [src]

Prototype

pub inline fn utf8EncodeComptime(comptime c: u21) [ utf8CodepointSequenceLength(c) catch |err| @compileError(@errorName(err)) ]u8

Parameters

c: u21

Source

pub inline fn utf8EncodeComptime(comptime c: u21) [ utf8CodepointSequenceLength(c) catch |err| @compileError(@errorName(err)) ]u8 { comptime var result: [ utf8CodepointSequenceLength(c) catch unreachable ]u8 = undefined; comptime assert((utf8Encode(c, &result) catch |err| @compileError(@errorName(err))) == result.len); return result; }