nyx_space::linalg

Trait DimRange

Source
pub trait DimRange<D>
where 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> DimRange<D> for usize
where D: Dim,

Source§

type Size = Const<1>

Source§

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

Source§

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

Source§

fn size(&self, _: D) -> <usize as DimRange<D>>::Size

Source§

impl<D> DimRange<D> for Range<usize>
where D: Dim,

Source§

type Size = Dyn

Source§

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

Source§

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

Source§

fn size(&self, _: D) -> <Range<usize> as DimRange<D>>::Size

Source§

impl<D> DimRange<D> for RangeFrom<usize>
where D: Dim,

Source§

type Size = Dyn

Source§

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

Source§

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

Source§

fn size(&self, dim: D) -> <RangeFrom<usize> as DimRange<D>>::Size

Source§

impl<D> DimRange<D> for RangeFull
where D: Dim,

Source§

type Size = D

Source§

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

Source§

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

Source§

fn size(&self, dim: D) -> <RangeFull as DimRange<D>>::Size

Source§

impl<D> DimRange<D> for RangeInclusive<usize>
where D: Dim,

Source§

type Size = Dyn

Source§

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

Source§

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

Source§

fn size(&self, _: D) -> <RangeInclusive<usize> as DimRange<D>>::Size

Source§

impl<D> DimRange<D> for RangeTo<usize>
where D: Dim,

Source§

type Size = Dyn

Source§

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

Source§

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

Source§

fn size(&self, _: D) -> <RangeTo<usize> as DimRange<D>>::Size

Implementors§