pub trait InExtent {
// Required method
fn in_(self, extent: &Extent) -> Result<Point, PointError>;
}
Expand description
Extension trait for creating a Point
from a coordinate vector
and an Extent
.
This trait provides the .in_(&extent)
method, which constructs a
Point
using the caller as the coordinate vector and the given
extent as the shape context.
§Example
use ndslice::Extent;
use ndslice::view::InExtent;
let extent = Extent::new(vec!["x".into(), "y".into()], vec![3, 4]).unwrap();
let point = vec![1, 2].in_(&extent).unwrap();
assert_eq!(point.rank(), 1 * 4 + 2);