pub trait Get2D {
type Item;
// Required method
fn try_get_xy<T: ToPrimitive>(
&self,
x: T,
y: T,
) -> Result<&Self::Item, IndexError>;
// Provided methods
fn get_xy<T: ToPrimitive>(&self, x: T, y: T) -> &Self::Item { ... }
fn get_p<T: ToPrimitive, P: IntoTuple2<T>>(&self, p: P) -> &Self::Item { ... }
fn try_get_p<T: ToPrimitive, P: IntoTuple2<T>>(
&self,
p: P,
) -> Result<&Self::Item, IndexError> { ... }
}Expand description
A trait which provides common access interfaces to 2D Array type.
Required Associated Types§
Required Methods§
fn try_get_xy<T: ToPrimitive>( &self, x: T, y: T, ) -> Result<&Self::Item, IndexError>
Provided Methods§
fn get_xy<T: ToPrimitive>(&self, x: T, y: T) -> &Self::Item
fn get_p<T: ToPrimitive, P: IntoTuple2<T>>(&self, p: P) -> &Self::Item
fn try_get_p<T: ToPrimitive, P: IntoTuple2<T>>( &self, p: P, ) -> Result<&Self::Item, IndexError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<D> Get2D for Vec<Vec<D>>
impl<D> Get2D for Vec<Vec<D>>
type Item = D
fn try_get_xy<T: ToPrimitive>( &self, x: T, y: T, ) -> Result<&Self::Item, IndexError>
Source§impl<P, C> Get2D for ImageBuffer<P, C>
Available on crate feature image only.
impl<P, C> Get2D for ImageBuffer<P, C>
Available on crate feature
image only.type Item = P
fn try_get_xy<T: ToPrimitive>( &self, x: T, y: T, ) -> Result<&Self::Item, IndexError>
Source§impl<S: Data> Get2D for ArrayBase<S, Ix2>
Available on crate feature ndarray only.
impl<S: Data> Get2D for ArrayBase<S, Ix2>
Available on crate feature
ndarray only.