Trait nalgebra::base::SliceRange

source ·
pub trait SliceRange<D: Dim> {
    type Size: Dim;

    // Required methods
    fn begin(&self, shape: D) -> usize;
    fn end(&self, shape: D) -> usize;
    fn size(&self, shape: D) -> Self::Size;
}
Expand description

A range with a size that may be known at compile-time.

This may be:

  • A single usize index, e.g., 4
  • A left-open range std::ops::RangeTo, e.g., .. 4
  • A right-open range std::ops::RangeFrom, e.g., 4 ..
  • A full range std::ops::RangeFull, e.g., ..

Required Associated Types§

source

type Size: Dim

Type of the range size. May be a type-level integer.

Required Methods§

source

fn begin(&self, shape: D) -> usize

The start index of the range.

source

fn end(&self, shape: D) -> usize

The index immediately after the last index inside of the range.

source

fn size(&self, shape: D) -> Self::Size

The number of elements of the range, i.e., self.end - self.begin.

Implementations on Foreign Types§

source§

impl<D: Dim> SliceRange<D> for usize

source§

type Size = Const<1>

source§

fn begin(&self, _: D) -> usize

source§

fn end(&self, _: D) -> usize

source§

fn size(&self, _: D) -> Self::Size

source§

impl<D: Dim> SliceRange<D> for Range<usize>

source§

type Size = Dynamic

source§

fn begin(&self, _: D) -> usize

source§

fn end(&self, _: D) -> usize

source§

fn size(&self, _: D) -> Self::Size

source§

impl<D: Dim> SliceRange<D> for RangeFrom<usize>

source§

type Size = Dynamic

source§

fn begin(&self, _: D) -> usize

source§

fn end(&self, dim: D) -> usize

source§

fn size(&self, dim: D) -> Self::Size

source§

impl<D: Dim> SliceRange<D> for RangeFull

source§

type Size = D

source§

fn begin(&self, _: D) -> usize

source§

fn end(&self, dim: D) -> usize

source§

fn size(&self, dim: D) -> Self::Size

source§

impl<D: Dim> SliceRange<D> for RangeInclusive<usize>

source§

type Size = Dynamic

source§

fn begin(&self, _: D) -> usize

source§

fn end(&self, _: D) -> usize

source§

fn size(&self, _: D) -> Self::Size

source§

impl<D: Dim> SliceRange<D> for RangeTo<usize>

source§

type Size = Dynamic

source§

fn begin(&self, _: D) -> usize

source§

fn end(&self, _: D) -> usize

source§

fn size(&self, _: D) -> Self::Size

Implementors§