pub struct Shapes {
pub nrows: usize,
pub ncols: usize,
pub colour: Colour,
pub shapes: Vec<Shape>,
}Fields§
§nrows: usize§ncols: usize§colour: Colour§shapes: Vec<Shape>Implementations§
Source§impl Shapes
impl Shapes
pub fn new() -> Self
pub const fn trivial() -> Self
pub fn new_sized(nrows: usize, ncols: usize) -> Self
pub fn new_given(nrows: usize, ncols: usize, shapes: &Vec<Shape>) -> Self
pub fn new_from_shape(shape: &Shape) -> Self
pub fn new_shapes(shapes: &[Shape]) -> Self
pub fn new_shapes_sized(nrows: usize, ncols: usize, shapes: &[Shape]) -> Self
pub fn clone_base(&self) -> Self
pub fn merge_mut(&mut self, other: &Self)
pub fn join_shapes_same_colour(&self) -> Self
pub fn find_straight_pairs(&self) -> BTreeMap<Shape, Shape>
pub fn group_containers(&self) -> BTreeMap<Shape, Vec<Shape>>
pub fn coords_to_shape(&self) -> BTreeMap<(usize, usize), Shape>
pub fn centre_of(&self) -> BTreeMap<(usize, usize), Shape>
pub fn border_gravity(&self) -> BTreeMap<Colour, Direction>
pub fn in_range(&self, rc: usize, vertical: bool) -> bool
pub fn full_shapes(&self) -> Vec<Shape>
pub fn full_shapes_sq(&self) -> Vec<Shape>
pub fn all_shapes(&self) -> Vec<Shape>
pub fn contains_shape(&self, shape: &Shape) -> bool
pub fn contains_origin(shapes: &Vec<&Shape>, r: usize, c: usize) -> bool
pub fn all_shapes_sq(&self) -> Vec<Shape>
pub fn shape_permutations(&self) -> Self
pub fn find_shape_colours(&self) -> Vec<Colour>
pub fn get_pixels(&self) -> Shapes
pub fn is_line(&self) -> bool
pub fn has_band(&self) -> (Direction, usize)
pub fn is_square(&self) -> bool
pub fn is_square_same(&self) -> bool
pub fn anomalous_colour(&self) -> Option<Colour>
pub fn embellish(&self, colour: Colour) -> Shapes
pub fn colours(&self) -> Vec<Colour>
pub fn find_repeats(&self) -> (usize, usize)
pub fn find_gaps(&self) -> (usize, usize)
pub fn anomalous_size(&self) -> Option<usize>
pub fn colour_groups_to_shapes(&self, bg: Colour) -> Shapes
pub fn colour_cnt(&self) -> BTreeMap<Colour, usize>
pub fn cell_colour_cnt(&self) -> BTreeMap<Colour, usize>
pub fn size_cnt(&self) -> BTreeMap<usize, usize>
pub fn nearest_shape(&self, r: usize, c: usize) -> Shape
pub fn full_extent(&self) -> Shape
pub fn all_corners(&self) -> Vec<(usize, usize)>
pub fn vec_corners(shapes: &Vec<Shape>) -> (usize, usize, usize, usize)
pub fn corners(&self) -> (usize, usize, usize, usize)
pub fn origins(shapes: &Vec<&Shape>) -> Vec<(usize, usize)>
pub fn to_shape(&self) -> Shape
pub fn border_only(&self) -> Shape
pub fn all(&self) -> Vec<Shape>
pub fn smallest(&self) -> Shape
pub fn largest(&self) -> Shape
pub fn largest_solid(&self) -> Shape
pub fn largest_solid_colour(&self, colour: Colour) -> Shape
pub fn hollow_cnt_colour_map(&self) -> BTreeMap<usize, Colour>
pub fn hollow_cnt_max(&self) -> Shape
pub fn hollow_cnt_min(&self) -> Shape
pub fn hollow_cnt_map(&self) -> BTreeMap<usize, Vec<Shape>>
pub fn hollow_cnt_unique(&self) -> Shape
pub fn first(&self) -> Shape
pub fn last(&self) -> Shape
pub fn shape_colour_cnt_map(&self) -> BTreeMap<Colour, Vec<Shape>>
pub fn pixels_in_shapes(&self, shape: &Shape) -> Vec<Shape>
pub fn overlay_shapes_same_colour(&self) -> bool
pub fn overlay_shapes_diff_colour(&self) -> bool
pub fn consolidate_shapes(&self) -> Self
pub fn find_pixels(&self) -> Self
pub fn find_shapes(&self) -> Self
pub fn size(&self) -> usize
pub fn width(&self) -> usize
pub fn height(&self) -> usize
pub fn find_by_colour(&self, colour: Colour) -> Shape
pub fn find_min(&self) -> Shape
pub fn find_max(&self) -> Shape
pub fn find_sub_min(&self) -> Shape
pub fn find_sub_max(&self) -> Shape
pub fn find_pixels_min(&self) -> Shape
pub fn find_pixels_max(&self) -> Shape
pub fn find_max_colour_count(&self) -> Shape
pub fn find_sub_largest_count(&self) -> Shape
pub fn position_pixels(&self) -> Option<(Self, Self)>
pub fn contained_pairs(&self) -> BTreeMap<Shape, Shape>
pub fn pair_shapes( &self, other: &Shapes, match_colour: bool, ) -> Vec<(Shape, Shape, bool)>
pub fn toddle_colours(&self) -> Self
pub fn min_size(&self, sz: usize) -> (usize, usize)
pub fn split_size(&self, sz: usize) -> Self
pub fn majority_cell(&self) -> Shape
pub fn ignore_pixels(&self) -> Self
pub fn de_subshape(&self) -> Shapes
pub fn diff(&self, other: &Self) -> Option<Vec<Option<Shape>>>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn add(&mut self, shape: &Shape)
pub fn noise_colour(&self) -> Colour
pub fn important_shapes(&self) -> Vec<Shape>
pub fn remove(&mut self, shape: &Shape)
pub fn hollow_shapes(&self) -> Shapes
pub fn merge_replace_shapes(&self, other: &Self) -> Self
pub fn show_summary(&self)
pub fn show(&self)
pub fn show_full(&self)
pub fn trim_grid(&self) -> Self
pub fn trim_to_grid(&self) -> Grid
pub fn trim_to_grid_transparent(&self) -> Grid
pub fn to_grid(&self) -> Grid
pub fn to_grid_transparent(&self) -> Grid
pub fn to_grid_colour(&self, colour: Colour) -> Grid
pub fn to_grid_colour_transparent(&self, colour: Colour) -> Grid
pub fn to_grid_impl(&self, colour: Colour, transparent: bool) -> Grid
pub fn to_json(&self) -> String
pub fn shape_counts(&self) -> BTreeMap<u32, usize>
pub fn holes_sizes(&self) -> Vec<(Shape, usize)>
pub fn have_common_pixel(&self) -> (Colour, Vec<Self>)
pub fn striped_r(&self) -> Colour
pub fn striped_c(&self) -> Colour
pub fn shrink(&self) -> Self
pub fn fill_missing(&self, to: Colour) -> Self
pub fn pixel_dir(&self, grid: &Grid) -> BTreeMap<Shape, Vec<Direction>>
pub fn biggest_shape(&self) -> Shape
pub fn has_mirror_r(&self) -> Shape
pub fn has_mirror_c(&self) -> Shape
pub fn cell_colour_cnts(&self, colour: Colour) -> Shape
pub fn get_by_colour(&self, colour: Colour) -> Vec<Shape>
Trait Implementations§
impl StructuralPartialEq for Shapes
Auto Trait Implementations§
impl Freeze for Shapes
impl RefUnwindSafe for Shapes
impl Send for Shapes
impl Sync for Shapes
impl Unpin for Shapes
impl UnwindSafe for Shapes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more