Fix bug wherein the Codec was clearing the buf after decoding a message. Don't do thatgit stash pop!

This commit is contained in:
Tim Kuehn
2016-12-16 14:15:31 -08:00
parent be156f4d6b
commit f2bf1adf8b
3 changed files with 45 additions and 14 deletions

View File

@@ -136,3 +136,18 @@ pub fn spawn_core() -> reactor::Remote {
});
rx.recv().unwrap()
}
/// A struct that will format as the contained type if the type impls Debug.
pub struct Debugger<'a, T: 'a>(pub &'a T);
impl<'a, T: fmt::Debug> fmt::Debug for Debugger<'a, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(f, "{:?}", self.0)
}
}
impl<'a, T> fmt::Debug for Debugger<'a, T> {
default fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(f, "{{not debuggable}}")
}
}