From 3a9062785314c95e827016093f057ab385cb652a Mon Sep 17 00:00:00 2001 From: Annika Hannig Date: Sat, 27 Aug 2022 12:06:06 +0000 Subject: [PATCH] updated hello display example --- hello_display/rustfmt.toml | 1 + hello_display/src/main.rs | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) create mode 100644 hello_display/rustfmt.toml diff --git a/hello_display/rustfmt.toml b/hello_display/rustfmt.toml new file mode 100644 index 0000000..df99c69 --- /dev/null +++ b/hello_display/rustfmt.toml @@ -0,0 +1 @@ +max_width = 80 diff --git a/hello_display/src/main.rs b/hello_display/src/main.rs index a0f234c..0653c59 100644 --- a/hello_display/src/main.rs +++ b/hello_display/src/main.rs @@ -1,21 +1,17 @@ +use airportdisplay::{text::Text, Command, Display}; use anyhow::Result; -use airportdisplay::{ - Command, - Display, - text::Text, - text::Buffer, -}; fn main() -> Result<()> { println!("Sending hello display..."); let display = Display::open("172.23.42.29:2342".into())?; - let text = Command::Text(Text::Buffer( - Buffer::from( - "♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥\n♥ mauuu ♥\n♥ mau mauuuunz! ♥\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥".to_string()))); + let text: String = + "♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥\n♥ mauuu ♥\n♥ mau mauuuunz! ♥\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥".into(); + + println!("{}", text); display.send(Command::Clear)?; - display.send(text)?; + display.send(Command::Text(Text::Buffer(text.into())))?; Ok(()) }