diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-09 09:34:26 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-09 14:58:57 -0500 |
commit | 1df95eca71e5f2a9cb9adb2995a7552ec980dc8b (patch) | |
tree | 28611bcc57d3b9a79273204e50db2c54c8cfebf9 /src/cell.rs | |
parent | 4e774bc93fc9aaa1f84db7736cd45eef71e712cc (diff) | |
download | vt100-rust-1df95eca71e5f2a9cb9adb2995a7552ec980dc8b.tar.gz vt100-rust-1df95eca71e5f2a9cb9adb2995a7552ec980dc8b.zip |
another micro-optimization
Diffstat (limited to 'src/cell.rs')
-rw-r--r-- | src/cell.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cell.rs b/src/cell.rs index 8d7e32f..d0d6f0c 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -9,8 +9,10 @@ pub struct Cell { } impl Cell { - pub(crate) fn set(&mut self, c: String, a: crate::attrs::Attrs) { - self.contents = c; + pub(crate) fn set(&mut self, c: char, a: crate::attrs::Attrs) { + let mut buf = vec![0; 4]; + c.encode_utf8(&mut buf); + self.contents = unsafe { String::from_utf8_unchecked(buf) }; self.attrs = a; } |