BlockDim

Trait BlockDim 

Source
pub trait BlockDim: Clone {
    const SHIFT: usize;
    const WIDTH: usize = _;
    const AREA: usize = _;
    const MASK: usize = _;

    // Provided method
    fn round_up_to_valid(rows: usize, cols: usize) -> (usize, usize) { ... }
}
Expand description

A type that represents compile time block dimensions.

Required Associated Constants§

Source

const SHIFT: usize

Number of left shifts of 1 for value.

Provided Associated Constants§

Source

const WIDTH: usize = _

Width and height of 2D block.

Source

const AREA: usize = _

Number of elements in 2D block.

Source

const MASK: usize = _

Bitmask for value.

Provided Methods§

Source

fn round_up_to_valid(rows: usize, cols: usize) -> (usize, usize)

Rounds up dimensions to next valid size. Returns (rows, cols).

§Example
use block_grid::{BlockDim, U4};

// (3, 10) are not valid dimensions for a block size of 4
let new_valid = U4::round_up_to_valid(3, 10);
// (4, 12) are the returned valid dimensions
assert_eq!(new_valid, (4, 12));

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.

Implementors§

Source§

impl BlockDim for U1

Source§

const SHIFT: usize = 0usize

Source§

impl BlockDim for U2

Source§

const SHIFT: usize = 1usize

Source§

impl BlockDim for U4

Source§

const SHIFT: usize = 2usize

Source§

impl BlockDim for U8

Source§

const SHIFT: usize = 3usize

Source§

impl BlockDim for U16

Source§

const SHIFT: usize = 4usize

Source§

impl BlockDim for U32

Source§

const SHIFT: usize = 5usize

Source§

impl BlockDim for U64

Source§

const SHIFT: usize = 6usize

Source§

impl BlockDim for U128

Source§

const SHIFT: usize = 7usize

Source§

impl BlockDim for U256

Source§

const SHIFT: usize = 8usize

Source§

impl BlockDim for U512

Source§

const SHIFT: usize = 9usize