aboutsummaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-10-14 16:38:15 -0700
committerJoe Wilm <joe@jwilm.com>2016-10-14 16:38:15 -0700
commit71de5501c450eeaa363aa5403a5258d231d64935 (patch)
treee2399301b7fde92f04389f74ae4215ee3f794f86 /src/util.rs
parent1d60fdd6e3eb4fb7d42a26de29af3bea56785564 (diff)
downloadalacritty-71de5501c450eeaa363aa5403a5258d231d64935.tar.gz
alacritty-71de5501c450eeaa363aa5403a5258d231d64935.zip
Rustup and update dependencies
Now uses serde_dervive \o/
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs
index 69715d8e..eddb2a5a 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -27,3 +27,17 @@ pub mod thread {
pub use ::std::thread::*;
}
+pub fn encode_char(c: char) -> Vec<u8> {
+ let mut buf = Vec::with_capacity(4);
+ unsafe {
+ buf.set_len(4);
+ let len = {
+ let s = c.encode_utf8(&mut buf[..]);
+ s.len()
+ };
+ buf.set_len(len);
+ }
+
+ buf
+}
+