[−][src]Struct toodee::TooDeeViewMut
Provides a mutable view (or subset), of a TooDee
array.
Implementations
impl<'a, T> TooDeeViewMut<'a, T>
[src]
pub fn new(
num_cols: usize,
num_rows: usize,
data: &'a mut [T]
) -> TooDeeViewMut<'a, T>
[src]
num_cols: usize,
num_rows: usize,
data: &'a mut [T]
) -> TooDeeViewMut<'a, T>
Create a new TooDeeViewMut
using the provided mutable slice reference.
Panics
Panics if one of the dimensions is zero but the other is non-zero. This is to enforce the rule that empty arrays have no dimensions.
Panics if the slice's length is not sufficient to represent the desired array dimensions.
Examples
use toodee::TooDeeViewMut; let mut data = vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; let view_mut = TooDeeViewMut::new(4, 3, &mut data);
Trait Implementations
impl<T, '_> CopyOps<T> for TooDeeViewMut<'_, T>
[src]
fn copy_from_slice(&mut self, src: &[T]) where
T: Copy,
[src]
T: Copy,
fn clone_from_slice(&mut self, src: &[T]) where
T: Clone,
[src]
T: Clone,
fn copy_from_toodee(&mut self, src: &impl TooDeeOps<T>) where
T: Copy,
[src]
T: Copy,
fn clone_from_toodee(&mut self, src: &impl TooDeeOps<T>) where
T: Clone,
[src]
T: Clone,
fn copy_within(&mut self, src: (Coordinate, Coordinate), dest: Coordinate) where
T: Copy,
[src]
T: Copy,
impl<T, '_> Debug for TooDeeViewMut<'_, T> where
T: Debug,
[src]
T: Debug,
impl<'a, T: Eq> Eq for TooDeeViewMut<'a, T>
[src]
impl<T, '_> From<TooDeeViewMut<'_, T>> for TooDee<T> where
T: Clone,
[src]
T: Clone,
fn from(view: TooDeeViewMut<'_, T>) -> Self
[src]
impl<'a, T: Hash> Hash for TooDeeViewMut<'a, T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, T> Index<(usize, usize)> for TooDeeViewMut<'a, T>
[src]
type Output = T
The returned type after indexing.
fn index(&self, coord: Coordinate) -> &Self::Output
[src]
impl<'a, T> Index<usize> for TooDeeViewMut<'a, T>
[src]
type Output = [T]
The returned type after indexing.
fn index(&self, row: usize) -> &Self::Output
[src]
impl<'a, T> IndexMut<(usize, usize)> for TooDeeViewMut<'a, T>
[src]
fn index_mut(&mut self, coord: Coordinate) -> &mut Self::Output
[src]
impl<'a, T> IndexMut<usize> for TooDeeViewMut<'a, T>
[src]
impl<'a, T> Into<TooDeeView<'a, T>> for TooDeeViewMut<'a, T>
[src]
fn into(self) -> TooDeeView<'a, T>
[src]
impl<'a, T> IntoIterator for &'a TooDeeViewMut<'a, T>
[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = Cells<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T> IntoIterator for &'a mut TooDeeViewMut<'a, T>
[src]
type Item = &'a mut T
The type of the elements being iterated over.
type IntoIter = CellsMut<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T: PartialEq> PartialEq<TooDeeViewMut<'a, T>> for TooDeeViewMut<'a, T>
[src]
fn eq(&self, other: &TooDeeViewMut<'a, T>) -> bool
[src]
fn ne(&self, other: &TooDeeViewMut<'a, T>) -> bool
[src]
impl<T, '_> SortOps<T> for TooDeeViewMut<'_, T>
[src]
fn sort_row_ord<F>(&mut self, row: usize) where
T: Ord,
[src]
T: Ord,
fn sort_unstable_row_ord<F>(&mut self, row: usize) where
T: Ord,
[src]
T: Ord,
fn sort_by_row<F>(&mut self, row: usize, compare: F) where
F: FnMut(&T, &T) -> Ordering,
[src]
F: FnMut(&T, &T) -> Ordering,
fn sort_unstable_by_row<F>(&mut self, row: usize, compare: F) where
F: FnMut(&T, &T) -> Ordering,
[src]
F: FnMut(&T, &T) -> Ordering,
fn sort_by_row_key<B, F>(&mut self, row: usize, f: F) where
B: Ord,
F: FnMut(&T) -> B,
[src]
B: Ord,
F: FnMut(&T) -> B,
fn sort_unstable_by_row_key<B, F>(&mut self, row: usize, f: F) where
B: Ord,
F: FnMut(&T) -> B,
[src]
B: Ord,
F: FnMut(&T) -> B,
fn sort_col_ord<F>(&mut self, col: usize) where
T: Ord,
[src]
T: Ord,
fn sort_by_col<F>(&mut self, col: usize, compare: F) where
F: FnMut(&T, &T) -> Ordering,
[src]
F: FnMut(&T, &T) -> Ordering,
fn sort_unstable_by_col<F>(&mut self, col: usize, compare: F) where
F: FnMut(&T, &T) -> Ordering,
[src]
F: FnMut(&T, &T) -> Ordering,
fn sort_by_col_key<B, F>(&mut self, col: usize, f: F) where
B: Ord,
F: FnMut(&T) -> B,
[src]
B: Ord,
F: FnMut(&T) -> B,
fn sort_unstable_by_col_key<B, F>(&mut self, col: usize, f: F) where
B: Ord,
F: FnMut(&T) -> B,
[src]
B: Ord,
F: FnMut(&T) -> B,
impl<'a, T> StructuralEq for TooDeeViewMut<'a, T>
[src]
impl<'a, T> StructuralPartialEq for TooDeeViewMut<'a, T>
[src]
impl<'a, T> TooDeeOps<T> for TooDeeViewMut<'a, T>
[src]
fn num_rows(&self) -> usize
[src]
fn num_cols(&self) -> usize
[src]
fn bounds(&self) -> (Coordinate, Coordinate)
[src]
fn view(&self, start: Coordinate, end: Coordinate) -> TooDeeView<'_, T>
[src]
fn rows(&self) -> Rows<'_, T>ⓘ
[src]
fn col(&self, col: usize) -> Col<'_, T>ⓘ
[src]
fn size(&self) -> (usize, usize)
[src]
fn is_empty(&self) -> bool
[src]
fn cells(&self) -> Cells<'_, T>
[src]
impl<'a, T> TooDeeOpsMut<T> for TooDeeViewMut<'a, T>
[src]
fn view_mut(
&mut self,
start: Coordinate,
end: Coordinate
) -> TooDeeViewMut<'_, T>
[src]
&mut self,
start: Coordinate,
end: Coordinate
) -> TooDeeViewMut<'_, T>
fn rows_mut(&mut self) -> RowsMut<'_, T>ⓘ
[src]
fn col_mut(&mut self, col: usize) -> ColMut<'_, T>ⓘ
[src]
fn swap_rows(&mut self, r1: usize, r2: usize)
[src]
Swap/exchange the data between two rows.
Panics
Panics if either row index is out of bounds.
Examples
use toodee::{TooDee,TooDeeOps,TooDeeOpsMut}; let mut toodee : TooDee<u32> = TooDee::init(10, 5, 42u32); toodee[0].iter_mut().for_each(|v| *v = 1); assert_eq!(toodee[(0, 2)], 42); toodee.swap_rows(0, 2); assert_eq!(toodee[(0, 2)], 1);
fn cells_mut(&mut self) -> CellsMut<'_, T>
[src]
fn fill<V>(&mut self, fill: V) where
V: Borrow<T>,
T: Clone,
[src]
V: Borrow<T>,
T: Clone,
fn swap_cols(&mut self, c1: usize, c2: usize)
[src]
fn row_pair_mut(&mut self, r1: usize, r2: usize) -> (&mut [T], &mut [T])
[src]
impl<T, '_> TranslateOps<T> for TooDeeViewMut<'_, T>
[src]
fn translate_with_wrap(&mut self, mid: Coordinate)
[src]
fn flip_rows(&mut self)
[src]
fn flip_cols(&mut self)
[src]
Auto Trait Implementations
impl<'a, T> Send for TooDeeViewMut<'a, T> where
T: Send,
T: Send,
impl<'a, T> Sync for TooDeeViewMut<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for TooDeeViewMut<'a, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,