chatty-rs 0.0.1-alpha1

A terminal-based chat client for OpenAI's GPT models.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crossterm::event::{Event, EventStream};
use std::pin::Pin;

type StreamOutput = Option<Result<Event, std::io::Error>>;

pub trait CrosstermStream: Send + Sync + 'static {
    fn next(&mut self) -> Pin<Box<dyn Future<Output = StreamOutput> + Send + '_>>;
}

impl CrosstermStream for EventStream {
    fn next(&mut self) -> Pin<Box<dyn Future<Output = StreamOutput> + Send + '_>> {
        Box::pin(futures::StreamExt::next(self))
    }
}