From 4719fbdb28d8f20c44aed7a6ceab61997961f01f Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Sat, 22 Oct 2016 15:56:02 +0200 Subject: [PATCH] Allow start and end of window to match length of underlying slice. --- src/io/window.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/io/window.rs b/src/io/window.rs index c61360990..2d9a62112 100644 --- a/src/io/window.rs +++ b/src/io/window.rs @@ -73,7 +73,7 @@ impl> Window { /// This method will panic if `start` is out of bounds for the underlying /// slice or if it comes after the `end` configured in this window. pub fn set_start(&mut self, start: usize) -> &mut Window { - assert!(start < self.inner.as_ref().len()); + assert!(start <= self.inner.as_ref().len()); assert!(start <= self.range.end); self.range.start = start; self @@ -86,9 +86,9 @@ impl> Window { /// # Panics /// /// This method will panic if `end` is out of bounds for the underlying - /// slice or if it comes after the `end` configured in this window. + /// slice or if it comes before the `start` configured in this window. pub fn set_end(&mut self, end: usize) -> &mut Window { - assert!(end < self.inner.as_ref().len()); + assert!(end <= self.inner.as_ref().len()); assert!(self.range.start <= end); self.range.end = end; self