Parsing an AsyncSequence #324
Unanswered
Tyler-Keith-Thompson
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I'm not sure if the
Stream
type already handles this, both the tests and documentation lead me to believe thatStream
only works on synchronous sequences.Here's where it gets interesting. As data streams in with my AsyncSequence I know it'll be well-structured but I don't know that a given chunk is fully parseable. It's entirely possible, likely even that a chunk got split right in the middle of where something gets parsed and you need to wait for the next chunk to continue.
As a "simplified" use-case imagine parsing ANSII escape sequences into colored text as part of data that's streaming in. Such an escape sequence might look like:
ESC[0;32mThis text is green
However you might get split on 2 chunks like
ESC[0
,;32mThis text is green
.Is the library currently capable of handling this kind of use case?
To be clear, I'd still like to render as much as could be parsed while I wait on the next chunk.
Beta Was this translation helpful? Give feedback.
All reactions