diff --git a/src/base/matrix_slice.rs b/src/base/matrix_slice.rs index ffe95c8a..129493d6 100644 --- a/src/base/matrix_slice.rs +++ b/src/base/matrix_slice.rs @@ -1,5 +1,5 @@ use std::marker::PhantomData; -use std::ops::{Range, RangeFrom, RangeFull, RangeTo}; +use std::ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeTo}; use std::slice; use crate::base::allocator::Allocator; @@ -806,6 +806,25 @@ impl SliceRange for RangeFull { } } +impl SliceRange for RangeInclusive { + type Size = Dynamic; + + #[inline(always)] + fn begin(&self, _: D) -> usize { + *self.start() + } + + #[inline(always)] + fn end(&self, _: D) -> usize { + *self.end() + 1 + } + + #[inline(always)] + fn size(&self, _: D) -> Self::Size { + Dynamic::new(*self.end() + 1 - *self.start()) + } +} + // TODO: see how much of this overlaps with the general indexing // methods from indexing.rs. impl> Matrix {