View Source Lightning.Runtime.LogAgent.StringBuffer (Lightning v2.10.4)
Internal datastructure to hold and process new bytes for a list of characters.
By checking the if the buffer is a complete grapheme, emitting the buffer
once valid and returning nil
otherwise.
In the case of emojis and other language character sets, a character (in UTF-8) can be between 1-4 bytes - when streaming logs for example it's quite easy to receive less than the whole character which can result in crashes or corrupt text.
Summary
Types
@type t() :: {buffer :: buffer(), chunk_state :: chunk_state()}