Add description examples
This commit is contained in:
parent
e57348a276
commit
c73606f9b6
1 changed files with 14 additions and 0 deletions
14
src/lib.rs
14
src/lib.rs
|
@ -20,6 +20,20 @@ use std::cmp::Eq;
|
|||
/// No other dependencies except for the std lib are used.
|
||||
///
|
||||
/// Most of the functions `std::Vec<T>` offer are also implemented in `grid` and slightly modified for a 2D data object.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use grid::*;
|
||||
/// let mut grid = grid![[1,2,3]
|
||||
/// [4,5,6]];
|
||||
/// assert_eq!(grid, Grid::from_vec(vec![1,2,3,4,5,6],3));
|
||||
/// assert_eq!(grid.get(0,2), Some(&3));
|
||||
/// assert_eq!(grid[1][1], 5);
|
||||
/// assert_eq!(grid.size(), (2,3));
|
||||
/// grid.push_row(vec![7,8,9]);
|
||||
/// assert_eq!(grid, grid![[1,2,3][4,5,6][7,8,9]])
|
||||
/// ```
|
||||
use std::fmt;
|
||||
use std::iter::StepBy;
|
||||
use std::ops::Index;
|
||||
|
|
Loading…
Reference in a new issue