Trait surf_n_term::surface::Surface[][src]

pub trait Surface {
    type Item;
Show methods fn shape(&self) -> Shape;
fn data(&self) -> &[Self::Item]; fn is_empty(&self) -> bool { ... }
fn height(&self) -> usize { ... }
fn width(&self) -> usize { ... }
fn hash(&self) -> u64
    where
        Self::Item: Hash
, { ... }
fn get(&self, row: usize, col: usize) -> Option<&Self::Item> { ... }
fn iter(&self) -> SurfaceIter<'_, Self::Item>

Notable traits for SurfaceIter<'a, T>

impl<'a, T: 'a> Iterator for SurfaceIter<'a, T> type Item = &'a T;
{ ... }
fn view<RS, CS>(&self, rows: RS, cols: CS) -> SurfaceView<'_, Self::Item>
    where
        RS: ViewBounds,
        CS: ViewBounds,
        Self: Sized
, { ... }
fn as_ref(&self) -> SurfaceView<'_, Self::Item> { ... }
fn view_owned<RS, CS>(self, rows: RS, cols: CS) -> SurfaceOwnedView<Self>
    where
        RS: ViewBounds,
        CS: ViewBounds,
        Self: Sized
, { ... }
fn transpose(self) -> SurfaceOwnedView<Self>
    where
        Self: Sized
, { ... }
fn map<F, T>(&self, f: F) -> SurfaceOwned<T>
    where
        F: FnMut(usize, usize, &Self::Item) -> T,
        Self: Sized
, { ... }
fn to_owned_surf(&self) -> SurfaceOwned<Self::Item>
    where
        Self::Item: Clone
, { ... }
}

Matrix like object used to store RGBA (in case of images) and Cell (in case of Terminal)

Associated Types

Loading content...

Required methods

fn shape(&self) -> Shape[src]

Shape describes data layout inside Self::data() slice.

fn data(&self) -> &[Self::Item][src]

Slice containing all the items

Note: This slice contains all elements backed by parent object and elements should be accesed using the offeset calculcated by Shape::offset

Loading content...

Provided methods

fn is_empty(&self) -> bool[src]

Check if surface is empty

fn height(&self) -> usize[src]

Height of the surface

fn width(&self) -> usize[src]

Width of the surface

fn hash(&self) -> u64 where
    Self::Item: Hash
[src]

fn get(&self, row: usize, col: usize) -> Option<&Self::Item>[src]

Get immutable reference to the elemetn specified by row and column

fn iter(&self) -> SurfaceIter<'_, Self::Item>

Notable traits for SurfaceIter<'a, T>

impl<'a, T: 'a> Iterator for SurfaceIter<'a, T> type Item = &'a T;
[src]

Iterator over immutable references to the items of the view in the row-major order

fn view<RS, CS>(&self, rows: RS, cols: CS) -> SurfaceView<'_, Self::Item> where
    RS: ViewBounds,
    CS: ViewBounds,
    Self: Sized
[src]

Create an immutable sub-surface restricted by rows and cols bounds.

fn as_ref(&self) -> SurfaceView<'_, Self::Item>[src]

fn view_owned<RS, CS>(self, rows: RS, cols: CS) -> SurfaceOwnedView<Self> where
    RS: ViewBounds,
    CS: ViewBounds,
    Self: Sized
[src]

Create owned sub-surface restricted by rows and cols bounds.

fn transpose(self) -> SurfaceOwnedView<Self> where
    Self: Sized
[src]

fn map<F, T>(&self, f: F) -> SurfaceOwned<T> where
    F: FnMut(usize, usize, &Self::Item) -> T,
    Self: Sized
[src]

fn to_owned_surf(&self) -> SurfaceOwned<Self::Item> where
    Self::Item: Clone
[src]

Create owned copy of the surface

Loading content...

Implementations on Foreign Types

impl<'a, S: ?Sized> Surface for &'a S where
    S: Surface
[src]

type Item = S::Item

fn shape(&self) -> Shape[src]

fn data(&self) -> &[Self::Item][src]

impl<'a, S: ?Sized> Surface for &'a mut S where
    S: Surface
[src]

type Item = S::Item

fn shape(&self) -> Shape[src]

fn data(&self) -> &[Self::Item][src]

impl<T> Surface for Arc<dyn Surface<Item = T>>[src]

type Item = T

fn shape(&self) -> Shape[src]

fn data(&self) -> &[Self::Item][src]

Loading content...

Implementors

impl Surface for Image[src]

type Item = RGBA

fn shape(&self) -> Shape[src]

fn hash(&self) -> u64[src]

fn data(&self) -> &[Self::Item][src]

impl<'a, T: 'a> Surface for SurfaceMutView<'a, T>[src]

type Item = T

fn shape(&self) -> Shape[src]

fn data(&self) -> &[Self::Item][src]

impl<'a, T: 'a> Surface for SurfaceView<'a, T>[src]

type Item = T

fn shape(&self) -> Shape[src]

fn data(&self) -> &[Self::Item][src]

impl<S> Surface for SurfaceOwnedView<S> where
    S: Surface
[src]

type Item = S::Item

fn shape(&self) -> Shape[src]

fn data(&self) -> &[Self::Item][src]

impl<T> Surface for SurfaceOwned<T>[src]

type Item = T

fn shape(&self) -> Shape[src]

fn data(&self) -> &[Self::Item][src]

Loading content...