aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-03-12 12:20:06 -0500
committerJesse Luehrs <doy@tozt.net>2021-03-12 12:20:06 -0500
commit7c06da9c0f3402efbc3954e9f14b1d039fd38929 (patch)
tree57d06edf5b1dd15b51c3bb771845ce215b698a53 /examples
parentf3498d0afe3bd36cf3e9f553776518fd458a39af (diff)
downloadtextmode-7c06da9c0f3402efbc3954e9f14b1d039fd38929.tar.gz
textmode-7c06da9c0f3402efbc3954e9f14b1d039fd38929.zip
move the guards back onto the main objects
Diffstat (limited to 'examples')
-rw-r--r--examples/async.rs2
-rw-r--r--examples/basic.rs2
-rw-r--r--examples/input.rs4
-rw-r--r--examples/tmux.rs16
4 files changed, 7 insertions, 17 deletions
diff --git a/examples/async.rs b/examples/async.rs
index 3ff4c92..5102aba 100644
--- a/examples/async.rs
+++ b/examples/async.rs
@@ -21,7 +21,7 @@ async fn run(tm: &mut textmode::Output) -> textmode::Result<()> {
fn main() {
smol::block_on(async {
- let (mut tm, _guard) = textmode::Output::new().await.unwrap();
+ let mut tm = textmode::Output::new().await.unwrap();
let e = run(&mut tm).await;
e.unwrap();
});
diff --git a/examples/basic.rs b/examples/basic.rs
index f3f846d..fb13d89 100644
--- a/examples/basic.rs
+++ b/examples/basic.rs
@@ -1,7 +1,7 @@
use textmode::Textmode as _;
fn main() {
- let (mut tm, _guard) = textmode::blocking::Output::new().unwrap();
+ let mut tm = textmode::blocking::Output::new().unwrap();
tm.move_to(5, 5);
tm.write_str("foo");
diff --git a/examples/input.rs b/examples/input.rs
index fa9215f..a3b1f1d 100644
--- a/examples/input.rs
+++ b/examples/input.rs
@@ -1,6 +1,6 @@
#[cfg(feature = "async")]
async fn async_main() {
- let (mut input, _raw) = textmode::Input::new().await.unwrap();
+ let mut input = textmode::Input::new().await.unwrap();
for arg in std::env::args().skip(1) {
match arg.as_str() {
"--disable-utf8" => input.parse_utf8(false),
@@ -34,7 +34,7 @@ fn main() {
#[cfg(not(feature = "async"))]
fn main() {
- let (mut input, _raw) = textmode::blocking::Input::new().unwrap();
+ let mut input = textmode::blocking::Input::new().unwrap();
for arg in std::env::args().skip(1) {
match arg.as_str() {
"--disable-utf8" => input.parse_utf8(false),
diff --git a/examples/tmux.rs b/examples/tmux.rs
index 0ceb40b..62e52c2 100644
--- a/examples/tmux.rs
+++ b/examples/tmux.rs
@@ -293,32 +293,22 @@ impl State {
#[must_use]
struct Tmux {
input: textmode::Input,
- _raw: textmode::RawGuard,
tm: textmode::Output,
- _screen: textmode::ScreenGuard,
state: State,
}
impl Tmux {
async fn new() -> Self {
- let (input, _raw) = textmode::Input::new().await.unwrap();
- let (tm, _screen) = textmode::Output::new().await.unwrap();
+ let input = textmode::Input::new().await.unwrap();
+ let tm = textmode::Output::new().await.unwrap();
let state = State::new();
- Self {
- input,
- _raw,
- tm,
- _screen,
- state,
- }
+ Self { input, tm, state }
}
async fn run(self, ex: &smol::Executor<'_>) {
let Self {
input,
- _raw,
mut tm,
- _screen,
mut state,
} = self;