aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-03-07 19:04:34 -0500
committerJesse Luehrs <doy@tozt.net>2021-03-07 19:04:34 -0500
commit5ec96e5d9a321a654777449bcd597ebabfaa6ffa (patch)
tree3e59cb73a6ecb1c13a64768b1761ec4423637328
parent33613d4a93bf4c0a68a38ab492688305c8e6673d (diff)
downloadtextmode-5ec96e5d9a321a654777449bcd597ebabfaa6ffa.tar.gz
textmode-5ec96e5d9a321a654777449bcd597ebabfaa6ffa.zip
reorganize a bit
-rw-r--r--examples/tmux.rs8
-rw-r--r--src/blocking/input.rs (renamed from src/input.rs)0
-rw-r--r--src/blocking/mod.rs4
-rw-r--r--src/blocking/output.rs (renamed from src/blocking.rs)10
-rw-r--r--src/lib.rs7
-rw-r--r--src/output.rs (renamed from src/async.rs)0
6 files changed, 16 insertions, 13 deletions
diff --git a/examples/tmux.rs b/examples/tmux.rs
index b85b603..ac7205d 100644
--- a/examples/tmux.rs
+++ b/examples/tmux.rs
@@ -93,7 +93,7 @@ impl State {
fn spawn_input_task(
&self,
ex: &smol::Executor<'_>,
- mut input: textmode::Input,
+ mut input: textmode::blocking::Input,
) {
let notify = self.wevents.clone();
ex.spawn(async move {
@@ -309,8 +309,8 @@ impl State {
#[must_use]
struct Tmux {
- input: textmode::Input,
- _raw: textmode::RawGuard,
+ input: textmode::blocking::Input,
+ _raw: textmode::blocking::RawGuard,
tm: textmode::Output,
_screen: textmode::ScreenGuard,
state: State,
@@ -318,7 +318,7 @@ struct Tmux {
impl Tmux {
async fn new() -> Self {
- let (input, _raw) = textmode::Input::new();
+ let (input, _raw) = textmode::blocking::Input::new();
let (tm, _screen) = textmode::Output::new().await.unwrap();
let state = State::new();
Self {
diff --git a/src/input.rs b/src/blocking/input.rs
index a61afa5..a61afa5 100644
--- a/src/input.rs
+++ b/src/blocking/input.rs
diff --git a/src/blocking/mod.rs b/src/blocking/mod.rs
new file mode 100644
index 0000000..d4ffe4a
--- /dev/null
+++ b/src/blocking/mod.rs
@@ -0,0 +1,4 @@
+pub(crate) mod input;
+pub use input::{Input, RawGuard};
+mod output;
+pub use output::{Output, ScreenGuard};
diff --git a/src/blocking.rs b/src/blocking/output.rs
index fe33e6e..3049cac 100644
--- a/src/blocking.rs
+++ b/src/blocking/output.rs
@@ -1,6 +1,6 @@
use std::io::Write as _;
-use super::private::TextmodeImpl as _;
+use crate::private::TextmodeImpl as _;
pub struct ScreenGuard {
cleaned_up: bool,
@@ -12,7 +12,7 @@ impl ScreenGuard {
return Ok(());
}
self.cleaned_up = true;
- write_stdout(super::DEINIT)
+ write_stdout(crate::DEINIT)
}
}
@@ -27,7 +27,7 @@ pub struct Output {
next: vt100::Parser,
}
-impl super::private::TextmodeImpl for Output {
+impl crate::private::TextmodeImpl for Output {
fn cur(&self) -> &vt100::Parser {
&self.cur
}
@@ -45,11 +45,11 @@ impl super::private::TextmodeImpl for Output {
}
}
-impl super::Textmode for Output {}
+impl crate::Textmode for Output {}
impl Output {
pub fn new() -> std::io::Result<(Self, ScreenGuard)> {
- write_stdout(super::INIT)?;
+ write_stdout(crate::INIT)?;
Ok((
Self::new_without_screen(),
ScreenGuard { cleaned_up: false },
diff --git a/src/lib.rs b/src/lib.rs
index da46ba6..1023167 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,13 +3,12 @@
pub mod color;
pub mod blocking;
-mod input;
-pub use input::{Input, Key, RawGuard};
+pub use crate::blocking::input::Key;
#[cfg(feature = "async")]
-mod r#async;
+mod output;
#[cfg(feature = "async")]
-pub use r#async::{Output, ScreenGuard};
+pub use output::{Output, ScreenGuard};
const INIT: &[u8] = b"\x1b7\x1b[?47h\x1b[2J\x1b[H\x1b[?25h";
const DEINIT: &[u8] = b"\x1b[?47l\x1b8\x1b[?25h";
diff --git a/src/async.rs b/src/output.rs
index 9e8c220..9e8c220 100644
--- a/src/async.rs
+++ b/src/output.rs