pub trait ReshapeSliceExt {
// Required method
fn reshape_with_limit(&self, limit: Limit) -> Slice;
}
Expand description
A trait for types that can be reshaped into a higher-dimensional view by factoring large extents into smaller ones.
This is implemented for Slice
, enabling ergonomic access to
reshape_with_limit
as a method.
§Example
use ndslice::Slice;
use ndslice::reshape::Limit;
use ndslice::reshape::ReshapeSliceExt;
let slice = Slice::new_row_major(vec![1024]);
let reshaped = slice.reshape_with_limit(Limit::new(32));
assert_eq!(reshaped.sizes(), &[32, 32]);
§Returns
A reshaped Slice
with increased dimensionality and preserved
layout.
Required Methods§
Sourcefn reshape_with_limit(&self, limit: Limit) -> Slice
fn reshape_with_limit(&self, limit: Limit) -> Slice
Returns a reshaped version of this structure by factoring each
dimension into smaller extents no greater than limit
,
preserving memory layout and flat index semantics. See
reshape_with_limit
for full behavior and rationale.
§Arguments
limit
: maximum size allowed in any reshaped dimension
§Returns
A reshaped Slice
with increased dimensionality and a
bijective mapping to the original.