chiark / gitweb /
Begin setting up the streaming subthread system.
authorSimon Tatham <anakin@pobox.com>
Sat, 30 Dec 2023 11:57:51 +0000 (11:57 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 31 Dec 2023 07:11:19 +0000 (07:11 +0000)
commit4d05f6c22e5dff378c06f306b5c776b926ffc520
treee4715899b4fe7ac534de9b396c7410e871625555
parent029d83a1c59e206b9b5a476b67c6fe17489281e1
Begin setting up the streaming subthread system.

This gives Client two new methods. The first starts a subthread
listening to a stream, given a lambda function that you pass into the
subthread to handle the response. The second runs in the context of
the main thread, and the idea is that you give that same response
straight back to the client.

The owner of a Client object is responsible for doing the plumbing in
between, to arrange that a response passed to the lambda in the
subthread is transferred back to the main thread and given to
process_stream_update.

The implementation of that plumbing in Tui sends the data back to the
main thread over a clone of the sync_channel we already had, so that
it's received in the same event loop as terminal input.

So far, nothing is done with the updates.

Also not done: it would be nice to be able to ask a subthread to
terminate, if it's not needed any more. That way if the user tries to
read one of the fast-moving public timelines, we can dismiss its
update thread as soon as they're not looking at that file any more.
src/client.rs
src/main.rs
src/tui.rs