jojo/improvements #2
23
flutr.rs
23
flutr.rs
@@ -1,23 +0,0 @@
|
|||||||
pub struct FlutR {
|
|
||||||
stream: TcpStream,
|
|
||||||
msgs: PixelMsgs,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FlutR {
|
|
||||||
fn new(host: Host, port: u16, msgs: PixelMsgs) -> Result<Self, std::io::Error> {
|
|
||||||
let stream = TcpStream::connect(format!("{host}:{port}"))?;
|
|
||||||
Ok(FlutR { stream, msgs })
|
|
||||||
}
|
|
||||||
|
|
||||||
fn flut(&mut self) {
|
|
||||||
for msg in self.msgs.clone() {
|
|
||||||
dbg!(&msg);
|
|
||||||
let result = self.stream.write(msg.as_str().as_bytes());
|
|
||||||
match result {
|
|
||||||
Ok(_) => (),
|
|
||||||
Err(err) => eprintln!("{err}"),
|
|
||||||
}
|
|
||||||
let _ = self.stream.flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,7 +18,7 @@ struct Args {
|
|||||||
image_path: PathBuf,
|
image_path: PathBuf,
|
||||||
host: Host,
|
host: Host,
|
||||||
|
|
||||||
#[arg(short, long, default_value_t = 1234)]
|
#[arg(default_value_t = 1234)]
|
||||||
port: u16,
|
port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user