[][src]Trait toodee::TooDeeOpsMut

pub trait TooDeeOpsMut<T>: TooDeeOps<T> + IndexMut<usize, Output = [T]> + IndexMut<Coordinate, Output = T> {
    fn view_mut(
        &mut self,
        start: Coordinate,
        end: Coordinate
    ) -> TooDeeViewMut<T>;
fn rows_mut(&mut self) -> RowsMut<T>;
fn col_mut(&mut self, col: usize) -> ColMut<T>; fn cells_mut(&mut self) -> CellsMut<T> { ... }
fn fill<V>(&mut self, fill: V)
    where
        V: Borrow<T>,
        T: Clone
, { ... }
fn swap_cols(&mut self, c1: usize, c2: usize) { ... }
fn swap_rows(&mut self, r1: usize, r2: usize) { ... }
fn row_pair_mut(&mut self, r1: usize, r2: usize) -> (&mut [T], &mut [T]) { ... } }

Defines operations common to both TooDee and TooDeeViewMut. Default implementations are provided where possible/practical.

Required methods

fn view_mut(&mut self, start: Coordinate, end: Coordinate) -> TooDeeViewMut<T>

Returns a mutable view (or subset) of the current area based on the coordinates provided.

fn rows_mut(&mut self) -> RowsMut<T>

Returns a mutable iterator of slices, where each slice represents the entire row of the object's area.

fn col_mut(&mut self, col: usize) -> ColMut<T>

Returns a mutable iterator over a single column

Loading content...

Provided methods

fn cells_mut(&mut self) -> CellsMut<T>

Returns an iterator that traverses all cells within the area.

fn fill<V>(&mut self, fill: V) where
    V: Borrow<T>,
    T: Clone

Fills the entire area with the specified value.

fn swap_cols(&mut self, c1: usize, c2: usize)

Swap/exchange the data between two columns.

fn swap_rows(&mut self, r1: usize, r2: usize)

Swap/exchange the data between two rows.

Panics

Panics if either row index is out of bounds.

fn row_pair_mut(&mut self, r1: usize, r2: usize) -> (&mut [T], &mut [T])

Return the specified rows as mutable slices.

Panics

Will panic if r1 and r2 are equal, or if either row index is out of bounds.

Loading content...

Implementors

impl<'a, T> TooDeeOpsMut<T> for TooDeeViewMut<'a, T>[src]

impl<T> TooDeeOpsMut<T> for TooDee<T>[src]

fn view_mut(&mut self, start: Coordinate, end: Coordinate) -> TooDeeViewMut<T>[src]

Examples

use toodee::{TooDee,TooDeeOps,TooDeeOpsMut};
let mut toodee : TooDee<u32> = TooDee::new(10, 5);
let view = toodee.view_mut((1,2), (8,4));
assert_eq!(view.num_cols(), 7);
assert_eq!(view.num_rows(), 2);

fn rows_mut(&mut self) -> RowsMut<T>[src]

Examples

use toodee::{TooDee,TooDeeOps,TooDeeOpsMut};
let mut toodee : TooDee<u32> = TooDee::new(10, 5);
let mut rows = toodee.rows_mut();
assert_eq!(rows.len(), 5);
let r0 = rows.next().unwrap();
assert_eq!(r0.len(), 10);

fn col_mut(&mut self, col: usize) -> ColMut<T>[src]

Examples

use toodee::{TooDee,TooDeeOps,TooDeeOpsMut};
let mut toodee : TooDee<u32> = TooDee::new(10, 5);
let mut col = toodee.col_mut(8);
assert_eq!(col.len(), 5);

fn fill<V>(&mut self, fill: V) where
    V: Borrow<T>,
    T: Clone
[src]

Examples

use toodee::{TooDee,TooDeeOps,TooDeeOpsMut};
let mut toodee : TooDee<u32> = TooDee::new(10, 5);
toodee.fill(42);
assert_eq!(toodee[1][1], 42);
Loading content...