[][src]Struct accel::module::Grid

pub struct Grid {
    pub x: u32,
    pub y: u32,
    pub z: u32,
}

Size of Grid (grid of blocks) in CUDA thread hierarchy

Every input integer and float convert into u32 using ToPrimitive. If the conversion is impossible, e.g. negative or too large integers, the conversion will panics.

Examples

  • Explicit creation
let grid1d = Grid::x(64);
assert_eq!(grid1d.x, 64);

let grid2d = Grid::xy(64, 128);
assert_eq!(grid2d.x, 64);
assert_eq!(grid2d.y, 128);

let grid3d = Grid::xyz(64, 128, 256);
assert_eq!(grid3d.x, 64);
assert_eq!(grid3d.y, 128);
assert_eq!(grid3d.z, 256);
  • From single integer (unsigned and signed)
let grid1d: Grid = 64_usize.into();
assert_eq!(grid1d.x, 64);

let grid1d: Grid = 64_i32.into();
assert_eq!(grid1d.x, 64);
  • From tuple
let grid1d: Grid = (64,).into();
assert_eq!(grid1d.x, 64);

let grid2d: Grid = (64, 128).into();
assert_eq!(grid2d.x, 64);
assert_eq!(grid2d.y, 128);

let grid3d: Grid = (64, 128, 256).into();
assert_eq!(grid3d.x, 64);
assert_eq!(grid3d.y, 128);
assert_eq!(grid3d.z, 256);

Fields

x: u32y: u32z: u32

Implementations

impl Grid[src]

pub fn x<I: ToPrimitive>(x: I) -> Self[src]

1D Grid

Panic

  • If input values cannot convert to u32

pub fn xy<I1: ToPrimitive, I2: ToPrimitive>(x: I1, y: I2) -> Self[src]

2D Grid

Panic

  • If input values cannot convert to u32

pub fn xyz<I1: ToPrimitive, I2: ToPrimitive, I3: ToPrimitive>(
    x: I1,
    y: I2,
    z: I3
) -> Self
[src]

3D Grid

Panic

  • If input values cannot convert to u32

Trait Implementations

impl Clone for Grid[src]

impl Copy for Grid[src]

impl Debug for Grid[src]

impl<I: ToPrimitive> Into<Grid> for (I,)[src]

impl<I1: ToPrimitive, I2: ToPrimitive> Into<Grid> for (I1, I2)[src]

impl Into<Grid> for i16[src]

impl Into<Grid> for i32[src]

impl Into<Grid> for i64[src]

impl Into<Grid> for i128[src]

impl Into<Grid> for isize[src]

impl<I1: ToPrimitive, I2: ToPrimitive, I3: ToPrimitive> Into<Grid> for (I1, I2, I3)[src]

impl Into<Grid> for u8[src]

impl Into<Grid> for u16[src]

impl Into<Grid> for u32[src]

impl Into<Grid> for u64[src]

impl Into<Grid> for u128[src]

impl Into<Grid> for usize[src]

impl Into<Grid> for i8[src]

impl PartialEq<Grid> for Grid[src]

impl PartialOrd<Grid> for Grid[src]

impl StructuralPartialEq for Grid[src]

Auto Trait Implementations

impl RefUnwindSafe for Grid

impl Send for Grid

impl Sync for Grid

impl Unpin for Grid

impl UnwindSafe for Grid

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.