pub trait IGrid<T, Idx, const N: usize>:
Sized
+ IRectangle<Idx, N>
+ Get<Vector<Idx, N>, Output = T, Output = T, Output = T>
+ Index<Vector<Idx, N>, Output = T, Output = T>
+ GetMut<Vector<Idx, N>>
+ GetManyMut<Vector<Idx, N>>
+ IndexMut<Vector<Idx, N>>where
Idx: Integer,{
type WithType<U>: IGrid<U, Idx, N>;
Show 21 methods
// Required methods
fn values(&self) -> &[T];
fn values_mut(&mut self) -> &mut [T];
fn into_size_and_values(self) -> (Vector<Idx, N>, Vec<T>);
unsafe fn from_vec_unchecked<P>(size: P, value: Vec<T>) -> Self
where P: Into<Vector<Idx, N>>;
// Provided methods
fn into_values(self) -> Vec<T> { ... }
unsafe fn position_to_index_unchecked<P>(&self, pos: P) -> usize
where P: Into<Vector<Idx, N>> { ... }
unsafe fn index_to_position_unchecked(&self, index: usize) -> Vector<Idx, N> { ... }
unsafe fn external_position_to_position_unchecked<P>(pos: P, size: P) -> P
where P: Into<Vector<Idx, N>> + From<Vector<Idx, N>> { ... }
fn position_to_index<P>(&self, pos: P) -> Option<usize>
where P: Into<Vector<Idx, N>> { ... }
fn index_to_position(&self, index: usize) -> Option<Vector<Idx, N>> { ... }
fn from_vec<P>(size: P, value: Vec<T>) -> Option<Self>
where P: Into<Vector<Idx, N>> { ... }
fn try_from_vec<P>(
size: P,
value: Vec<T>,
) -> Result<Self, GridBaseError<Idx, N>>
where P: Into<Vector<Idx, N>> { ... }
fn from_fn<P, F>(size: P, f: F) -> Self
where F: FnMut(P) -> T,
P: Into<Vector<Idx, N>>,
Vector<Idx, N>: Into<P> { ... }
fn from_fn_par<P, F>(size: P, f: F) -> Self
where F: Fn(P) -> T + Sync,
P: Into<Vector<Idx, N>>,
Vector<Idx, N>: Into<P>,
T: Send,
Idx: Sync { ... }
fn new(size: Vector<Idx, N>) -> Self
where T: Default { ... }
fn new_uniform(size: Vector<Idx, N>, value: T) -> Self
where T: Clone { ... }
fn from_fn_ndc<P, F>(size: P, f: F) -> Self
where P: Into<Vector<Idx, N>>,
Vector<Idx, N>: CastIntoComposite<f32, Output = Vector<f32, N>>,
F: FnMut(Vector<f32, N>) -> T { ... }
fn from_fn_ndc_with_precision<P, Precision, F>(size: P, f: F) -> Self
where P: Into<Vector<Idx, N>>,
Precision: Float,
Vector<Idx, N>: CastIntoComposite<Precision, Output = Vector<Precision, N>>,
F: FnMut(Vector<Precision, N>) -> T { ... }
fn from_fn_normalized<P, F>(size: P, f: F) -> Self
where P: Into<Vector<Idx, N>>,
Vector<Idx, N>: CastIntoComposite<f32, Output = Vector<f32, N>>,
F: FnMut(Vector<f32, N>) -> T { ... }
fn from_fn_normalized_with_precision<P, Precision, F>(size: P, f: F) -> Self
where P: Into<Vector<Idx, N>>,
Precision: Float,
Vector<Idx, N>: CastIntoComposite<Precision, Output = Vector<Precision, N>>,
F: FnMut(Vector<Precision, N>) -> T { ... }
fn map<Dest, F>(self, f: F) -> Self::WithType<Dest>
where F: FnMut(T) -> Dest { ... }
}Required Associated Types§
Required Methods§
fn values(&self) -> &[T]
fn values_mut(&mut self) -> &mut [T]
fn into_size_and_values(self) -> (Vector<Idx, N>, Vec<T>)
unsafe fn from_vec_unchecked<P>(size: P, value: Vec<T>) -> Self
Provided Methods§
fn into_values(self) -> Vec<T>
Sourceunsafe fn position_to_index_unchecked<P>(&self, pos: P) -> usize
unsafe fn position_to_index_unchecked<P>(&self, pos: P) -> usize
Used for the memory bijection between the one dimensional vector and the N-dimensional grid.
If you override this, you probably also want to override IGrid::index_to_position_unchecked and IGrid::external_position_to_position_unchecked
Sourceunsafe fn index_to_position_unchecked(&self, index: usize) -> Vector<Idx, N>
unsafe fn index_to_position_unchecked(&self, index: usize) -> Vector<Idx, N>
Used for the memory bijection between the one dimensional vector and the N-dimensional grid.
If you override this, you probably also want to override IGrid::position_to_index_unchecked and IGrid::external_position_to_position_unchecked
Sourceunsafe fn external_position_to_position_unchecked<P>(pos: P, size: P) -> P
unsafe fn external_position_to_position_unchecked<P>(pos: P, size: P) -> P
Used for the memory bijection between the one dimensional vector and the N-dimensional grid.
If you override this, you probably also want to override IGrid::position_to_index_unchecked and IGrid::index_to_position_unchecked
Sourcefn position_to_index<P>(&self, pos: P) -> Option<usize>
fn position_to_index<P>(&self, pos: P) -> Option<usize>
Used for the memory bijection between the one dimensional vector and the N-dimensional grid.
Sourcefn index_to_position(&self, index: usize) -> Option<Vector<Idx, N>>
fn index_to_position(&self, index: usize) -> Option<Vector<Idx, N>>
Used for the memory bijection between the one dimensional vector and the N-dimensional grid.
fn from_vec<P>(size: P, value: Vec<T>) -> Option<Self>
fn try_from_vec<P>( size: P, value: Vec<T>, ) -> Result<Self, GridBaseError<Idx, N>>
Sourcefn from_fn_par<P, F>(size: P, f: F) -> Self
fn from_fn_par<P, F>(size: P, f: F) -> Self
Create a grid from a function in parallel
Sourcefn new(size: Vector<Idx, N>) -> Selfwhere
T: Default,
fn new(size: Vector<Idx, N>) -> Selfwhere
T: Default,
Create a new grid and fill it with the Default value
Sourcefn new_uniform(size: Vector<Idx, N>, value: T) -> Selfwhere
T: Clone,
fn new_uniform(size: Vector<Idx, N>, value: T) -> Selfwhere
T: Clone,
Create a new grid and fill it by Clone the value
Sourcefn from_fn_ndc<P, F>(size: P, f: F) -> Self
fn from_fn_ndc<P, F>(size: P, f: F) -> Self
Create a grid from a Normalized Device Coordinates.
Each component of the vector will be between -1.0..=1.0
Sourcefn from_fn_ndc_with_precision<P, Precision, F>(size: P, f: F) -> Self
fn from_fn_ndc_with_precision<P, Precision, F>(size: P, f: F) -> Self
Create a grid from a Normalized Device Coordinates.
Each component of the vector will be between -1.0..=1.0
Sourcefn from_fn_normalized<P, F>(size: P, f: F) -> Self
fn from_fn_normalized<P, F>(size: P, f: F) -> Self
Create a grid from a Normalized Coordinates.
Each component of the vector will be between 0..=1.0
Sourcefn from_fn_normalized_with_precision<P, Precision, F>(size: P, f: F) -> Self
fn from_fn_normalized_with_precision<P, Precision, F>(size: P, f: F) -> Self
Create a grid from a Normalized Coordinates.
Each component of the vector will be between 0..=1.0
fn map<Dest, F>(self, f: F) -> Self::WithType<Dest>where
F: FnMut(T) -> Dest,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".