Created
January 20, 2020 21:19
-
-
Save lizmat/450fdafca96627e7075ef59641e62d72 to your computer and use it in GitHub Desktop.
Supply.decode implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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