1use bytes::BufMut; 2 3pub trait BufMutExt: BufMut { 4 fn put_str_nul(&mut self, s: &str); 5} 6 7impl BufMutExt for Vec<u8> { 8 fn put_str_nul(&mut self, s: &str) { 9 self.extend(s.as_bytes()); 10 self.push(0); 11 } 12}