repline: Promote to its own crate!

cl-repl: Major refactor based on the design of typeck.rs
This commit is contained in:
2024-04-19 07:30:17 -05:00
parent 01ffdb67a6
commit 2a62a1c714
21 changed files with 967 additions and 1114 deletions

21
repline/src/raw.rs Normal file
View File

@@ -0,0 +1,21 @@
//! Sets the terminal to [`raw`] mode for the duration of the returned object's lifetime.
/// Sets the terminal to raw mode for the duration of the returned object's lifetime.
pub fn raw() -> impl Drop {
Raw::default()
}
struct Raw();
impl Default for Raw {
fn default() -> Self {
std::thread::yield_now();
crossterm::terminal::enable_raw_mode()
.expect("should be able to transition into raw mode");
Raw()
}
}
impl Drop for Raw {
fn drop(&mut self) {
crossterm::terminal::disable_raw_mode()
.expect("should be able to transition out of raw mode");
}
}