Skip to content

Instantly share code, notes, and snippets.

@lizmat
Created January 20, 2020 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizmat/450fdafca96627e7075ef59641e62d72 to your computer and use it in GitHub Desktop.
Save lizmat/450fdafca96627e7075ef59641e62d72 to your computer and use it in GitHub Desktop.
Supply.decode implementation
supply {
my $decoder = Encoding::Registry.find($encoding).decoder;
my $chars;
whenever self -> \bytes {
$decoder.add-bytes(bytes);
$chars := $decoder.consume-available-chars;
emit $chars if $chars;
LAST {
$chars := $decoder.consume-all-chars;
emit $chars if $chars;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment