[][src]Struct accel::module::Block

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

Size of Block (thread block) 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 block1d = Block::x(64);
assert_eq!(block1d.x, 64);

let block2d = Block::xy(64, 128);
assert_eq!(block2d.x, 64);
assert_eq!(block2d.y, 128);

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

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

let block2d: Block = (64, 128).into();
assert_eq!(block2d.x, 64);
assert_eq!(block2d.y, 128);

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

Fields

x: u32y: u32z: u32

Implementations

impl Block[src]

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

1D Block

Panic

  • If input values cannot convert to u32

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

2D Block

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 Block

Panic

  • If input values cannot convert to u32

Trait Implementations

impl Clone for Block[src]

impl Copy for Block[src]

impl Debug for Block[src]

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

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

impl Into<Block> for i16[src]

impl Into<Block> for i32[src]

impl Into<Block> for i64[src]

impl Into<Block> for i128[src]

impl Into<Block> for isize[src]

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

impl Into<Block> for u8[src]

impl Into<Block> for u16[src]

impl Into<Block> for u32[src]

impl Into<Block> for u64[src]

impl Into<Block> for u128[src]

impl Into<Block> for usize[src]

impl Into<Block> for i8[src]

impl PartialEq<Block> for Block[src]

impl PartialOrd<Block> for Block[src]

impl StructuralPartialEq for Block[src]

Auto Trait Implementations

impl RefUnwindSafe for Block

impl Send for Block

impl Sync for Block

impl Unpin for Block

impl UnwindSafe for Block

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.