From 96482fb0d13ba3d1e4ca58d55d77fb41744c9de2 Mon Sep 17 00:00:00 2001 From: Andrew Cassidy Date: Mon, 25 Jul 2022 21:30:34 -0700 Subject: [PATCH] Rename and reformat --- src/{array2d.rs => Container2D.rs} | 15 ++++++++------- src/{index2d.rs => Index2D.rs} | 0 src/lib.rs | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) rename src/{array2d.rs => Container2D.rs} (87%) rename src/{index2d.rs => Index2D.rs} (100%) diff --git a/src/array2d.rs b/src/Container2D.rs similarity index 87% rename from src/array2d.rs rename to src/Container2D.rs index c2c1be5..00f5399 100644 --- a/src/array2d.rs +++ b/src/Container2D.rs @@ -1,4 +1,4 @@ -use crate::index2d::Index2D; +use crate::Index2D::Index2D; pub trait Container2D { type Output; @@ -50,7 +50,8 @@ impl<'a, D: Container2D, const M: u32, const N: u32> Container2D for View2D<'a, const WIDTH: u32 = N; fn get(&self, i: I) -> Option<&Self::Output> { - self.data.get(i.to_2d_offset(Self::WIDTH, Self::HEIGHT, self.r, self.c)?) + self.data + .get(i.to_2d_offset(Self::WIDTH, Self::HEIGHT, self.r, self.c)?) } } @@ -60,7 +61,8 @@ impl<'a, D: Container2DMut, const M: u32, const N: u32> Container2D for Slice2D< const WIDTH: u32 = N; fn get(&self, i: I) -> Option<&Self::Output> { - self.data.get(i.to_2d_offset(Self::WIDTH, Self::HEIGHT, self.r, self.c)?) + self.data + .get(i.to_2d_offset(Self::WIDTH, Self::HEIGHT, self.r, self.c)?) } } @@ -72,11 +74,10 @@ pub struct Slice2D<'a, D: Container2DMut, const M: u32, const N: u32> { data: &'a mut D, } -impl<'a, D: Container2DMut, const M: u32, const N: u32> Container2DMut -for Slice2D<'a, D, M, N> -{ +impl<'a, D: Container2DMut, const M: u32, const N: u32> Container2DMut for Slice2D<'a, D, M, N> { fn get_mut(&mut self, i: I) -> Option<&mut Self::Output> { - self.data.get_mut(i.to_2d_offset(Self::WIDTH, Self::HEIGHT, self.r, self.c)?) + self.data + .get_mut(i.to_2d_offset(Self::WIDTH, Self::HEIGHT, self.r, self.c)?) } } diff --git a/src/index2d.rs b/src/Index2D.rs similarity index 100% rename from src/index2d.rs rename to src/Index2D.rs diff --git a/src/lib.rs b/src/lib.rs index 4e11a00..eeaca96 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,2 +1,2 @@ -mod array2d; -mod index2d; \ No newline at end of file +mod Container2D; +mod Index2D;