updated hello display example

This commit is contained in:
Annika Hannig 2022-08-27 12:06:06 +00:00
parent 005bc6d297
commit 3a90627853
No known key found for this signature in database
GPG key ID: 62E226E47DDCE58D
2 changed files with 7 additions and 10 deletions

View file

@ -0,0 +1 @@
max_width = 80

View file

@ -1,21 +1,17 @@
use airportdisplay::{text::Text, Command, Display};
use anyhow::Result; use anyhow::Result;
use airportdisplay::{
Command,
Display,
text::Text,
text::Buffer,
};
fn main() -> Result<()> { fn main() -> Result<()> {
println!("Sending hello display..."); println!("Sending hello display...");
let display = Display::open("172.23.42.29:2342".into())?; let display = Display::open("172.23.42.29:2342".into())?;
let text = Command::Text(Text::Buffer( let text: String =
Buffer::from( "♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥\n♥ mauuu ♥\n♥ mau mauuuunz! ♥\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥".into();
"♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥\n♥ mauuu ♥\n♥ mau mauuuunz! ♥\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥".to_string())));
println!("{}", text);
display.send(Command::Clear)?; display.send(Command::Clear)?;
display.send(text)?; display.send(Command::Text(Text::Buffer(text.into())))?;
Ok(()) Ok(())
} }