Switch unimplemented to assert (#201)

The only caller already guards against the case.

Relates to #192
This commit is contained in:
Carl Lerche
2017-12-26 12:25:01 -08:00
committed by Sean McArthur
parent fc75311fae
commit de4c30a706

View File

@@ -130,12 +130,15 @@ impl Data<Bytes> {
} }
impl<T: Buf> Data<T> { impl<T: Buf> Data<T> {
/// Encode the data frame into the `dst` buffer.
///
/// # Panics
///
/// Panics if `dst` cannot contain the data frame.
pub(crate) fn encode_chunk<U: BufMut>(&mut self, dst: &mut U) { pub(crate) fn encode_chunk<U: BufMut>(&mut self, dst: &mut U) {
let len = self.data.remaining() as usize; let len = self.data.remaining() as usize;
if len > dst.remaining_mut() { assert!(dst.remaining_mut() >= len);
unimplemented!();
}
self.head().encode(len, dst); self.head().encode(len, dst);
dst.put(&mut self.data); dst.put(&mut self.data);