pub fn parse_fold_axis(axis: &str) -> Result<Vec<i64>, String>Expand description
Port of CLI/Utils.py::parse_fold_axis.
Translates a 1-indexed --axis value to 0-indexed axes:
"1"/"1-2"/"1,3"→ rangeset axes,x - 1for eachx > 0(axis0is ignored, like upstream)."-1"→ negative axis index (only a single number supported), resolved modulo the dimension count at fold time.
Returns the raw axis list; callers treat an empty list like Python’s
empty tuple assigned to DEFAULTS.fold_axis (falsy → fold along all
axes).
§Errors
Returns a RangeSet parse error string for malformed rangeset input, or
an invalid literal style error for malformed negative input, mirroring
the upstream RangeSetParseError / ValueError split.