diff options
author | Christian Duerr <contact@christianduerr.com> | 2019-11-04 18:06:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-04 18:06:02 +0100 |
commit | 5e3690d7ca88ab7eaf766ebdf478bf0c8076e694 (patch) | |
tree | 8586a89828b19398b7ed8866a59209bc5f402bd8 /examples | |
parent | 084f853e3f4b566c783867d9f043f6a1d974ba59 (diff) | |
parent | c093a671ce3abaebef4c8e2a71a76ad8cd4670a5 (diff) | |
download | r-alacritty-vte-5e3690d7ca88ab7eaf766ebdf478bf0c8076e694.tar.gz r-alacritty-vte-5e3690d7ca88ab7eaf766ebdf478bf0c8076e694.tar.bz2 r-alacritty-vte-5e3690d7ca88ab7eaf766ebdf478bf0c8076e694.zip |
Bump version to 0.4.0
Diffstat (limited to 'examples')
-rw-r--r-- | examples/parselog.rs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/examples/parselog.rs b/examples/parselog.rs index acd56dc..b63bcf8 100644 --- a/examples/parselog.rs +++ b/examples/parselog.rs @@ -16,8 +16,10 @@ impl vte::Perform for Log { } fn hook(&mut self, params: &[i64], intermediates: &[u8], ignore: bool, c: char) { - println!("[hook] params={:?}, intermediates={:?}, ignore={:?}, char={:?}", - params, intermediates, ignore, c); + println!( + "[hook] params={:?}, intermediates={:?}, ignore={:?}, char={:?}", + params, intermediates, ignore, c + ); } fn put(&mut self, byte: u8) { @@ -33,15 +35,18 @@ impl vte::Perform for Log { } fn csi_dispatch(&mut self, params: &[i64], intermediates: &[u8], ignore: bool, c: char) { - println!("[csi_dispatch] params={:?}, intermediates={:?}, ignore={:?}, char={:?}", - params, intermediates, ignore, c); + println!( + "[csi_dispatch] params={:?}, intermediates={:?}, ignore={:?}, char={:?}", + params, intermediates, ignore, c + ); } fn esc_dispatch(&mut self, params: &[i64], intermediates: &[u8], ignore: bool, byte: u8) { - println!("[esc_dispatch] params={:?}, intermediates={:?}, ignore={:?}, byte={:02x}", - params, intermediates, ignore, byte); + println!( + "[esc_dispatch] params={:?}, intermediates={:?}, ignore={:?}, byte={:02x}", + params, intermediates, ignore, byte + ); } - } fn main() { @@ -51,7 +56,7 @@ fn main() { let mut statemachine = vte::Parser::new(); let mut parser = Log; - let mut buf: [u8; 2048] = unsafe { std::mem::uninitialized() }; + let mut buf = [0; 2048]; loop { match handle.read(&mut buf) { @@ -60,7 +65,7 @@ fn main() { for byte in &buf[..n] { statemachine.advance(&mut parser, *byte); } - }, + } Err(err) => { println!("err: {}", err); break; |