If true, asssume c is a valid, non-surrogate UTF-32 code point and don't generate any error-checking code. If validated is true, c must be a valid character, otherwise undefined behavior will occur. Also affects the return type.
Buffer to write the encoded result to.
Character to encode.
If validated is true, number of bytes the encoded character takes up in buf. Otherwise a struct with a 'bytes' member specifying the number of bytes of the endocded character, and a 'string errorMessage' member that is null if there was no error and otherwise stores the error message.
@nogc version of std.utf.encode() for char[].
The caller must handle ASCII (< 0x80) characters manually; this is asserted to force code using this function to be efficient.