Skip to main content

s

Macro s 

Source
s!() { /* proc-macro */ }
Expand description

NumPy-style slice indexing macro.

Produces a Vec<ferray_core::dtype::SliceInfoElem> that can be passed to array slicing methods.

§Syntax

  • s![0..3, 2] — rows 0..3, column 2
  • s![.., 0..;2] — all rows, every-other column starting from 0
  • s![1..5;2, ..] — rows 1..5 step 2, all columns
  • s![3] — single integer index
  • s![..] — all elements along this axis
  • s![2..] — from index 2 to end
  • s![..5] — from start to index 5
  • s![1..5] — from index 1 to 5
  • s![1..5;2] — from index 1 to 5, step 2

Each component in the comma-separated list becomes one SliceInfoElem.