Trait InExtent

Source
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);

Required Methods§

Source

fn in_(self, extent: &Extent) -> Result<Point, PointError>

Implementations on Foreign Types§

Source§

impl InExtent for Vec<usize>

Source§

fn in_(self, extent: &Extent) -> Result<Point, PointError>

Creates a Point with the provided coordinates in the given extent.

Delegates to Extent::point.

Implementors§