Trait Get2D

Source
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§

Source

fn try_get_xy<T: ToPrimitive>( &self, x: T, y: T, ) -> Result<&Self::Item, IndexError>

Provided Methods§

Source

fn get_xy<T: ToPrimitive>(&self, x: T, y: T) -> &Self::Item

Source

fn get_p<T: ToPrimitive, P: IntoTuple2<T>>(&self, p: P) -> &Self::Item

Source

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>>

Source§

type Item = D

Source§

fn try_get_xy<T: ToPrimitive>( &self, x: T, y: T, ) -> Result<&Self::Item, IndexError>

Source§

impl<P, C> Get2D for ImageBuffer<P, C>
where P: Pixel + 'static, P::Subpixel: 'static, C: Deref<Target = [P::Subpixel]>,

Source§

type Item = P

Source§

fn try_get_xy<T: ToPrimitive>( &self, x: T, y: T, ) -> Result<&Self::Item, IndexError>

Source§

impl<S: Data> Get2D for ArrayBase<S, Ix2>

Source§

type Item = <S as RawData>::Elem

Source§

fn try_get_xy<T: ToPrimitive>( &self, x: T, y: T, ) -> Result<&Self::Item, IndexError>

Implementors§