From de4c30a7060bc690ad796fa1af4518a0f745071d Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Tue, 26 Dec 2017 12:25:01 -0800 Subject: [PATCH] Switch unimplemented to assert (#201) The only caller already guards against the case. Relates to #192 --- src/frame/data.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/frame/data.rs b/src/frame/data.rs index 9b76584..a3da435 100644 --- a/src/frame/data.rs +++ b/src/frame/data.rs @@ -130,12 +130,15 @@ impl Data { } impl Data { + /// Encode the data frame into the `dst` buffer. + /// + /// # Panics + /// + /// Panics if `dst` cannot contain the data frame. pub(crate) fn encode_chunk(&mut self, dst: &mut U) { let len = self.data.remaining() as usize; - if len > dst.remaining_mut() { - unimplemented!(); - } + assert!(dst.remaining_mut() >= len); self.head().encode(len, dst); dst.put(&mut self.data);