Trait AsIndex

pub trait AsIndex:
    Sized
    + Debug
    + Copy {
    // Required method
    fn index(self) -> isize;
}
Expand description

Helper trait for implementing indexing with support for negative indices.

§Example

use mabor_tensor::indexing::{AsIndex, canonicalize_dim};

fn example<I: AsIndex, const D: usize>(dim: I, size: usize) -> isize {
   let dim: usize = canonicalize_dim(dim, D, false);
   unimplemented!()
}

Required Methods§

fn index(self) -> isize

Converts into a slice index.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl AsIndex for i8

§

fn index(self) -> isize

§

impl AsIndex for i16

§

fn index(self) -> isize

§

impl AsIndex for i32

§

fn index(self) -> isize

§

impl AsIndex for i64

§

fn index(self) -> isize

§

impl AsIndex for isize

§

fn index(self) -> isize

§

impl AsIndex for u8

§

fn index(self) -> isize

§

impl AsIndex for u16

§

fn index(self) -> isize

§

impl AsIndex for u32

§

fn index(self) -> isize

§

impl AsIndex for u64

§

fn index(self) -> isize

§

impl AsIndex for usize

§

fn index(self) -> isize

Implementors§