From 3503001ec6a06522ba82da121f39e956300f3809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Sun, 20 Jan 2019 14:31:29 +0100 Subject: [PATCH] Add contract to Channel.consumeAll to force the input buffer to be empty. --- source/vibe/core/channel.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/vibe/core/channel.d b/source/vibe/core/channel.d index 3553b9e..9295cbc 100644 --- a/source/vibe/core/channel.d +++ b/source/vibe/core/channel.d @@ -84,7 +84,8 @@ struct Channel(T, size_t buffer_size) { avaiable, `dst` will be left untouched and `false` is returned. */ bool consumeAll(ref FixedRingBuffer!(T, buffer_size) dst) - { return m_impl.consumeAll(dst); } + in { assert(dst.empty); } + body { return m_impl.consumeAll(dst); } /** Enqueues an element.