Ran cargo fmt, clippy fixes, suppressed some warns

I will start working on stack traces tonight and tomorrow.

We need to be able to 'unwind' by finding calling functions.
This commit is contained in:
2025-03-04 23:06:47 +00:00
parent 8704b5d249
commit d53661b9a0
25 changed files with 300 additions and 176 deletions
+15 -4
View File
@@ -11,20 +11,31 @@ pub struct Frame<'f> {
impl<'a> Frame<'a> {
pub fn new(window: &'a Window) -> Self {
Self {
data: vec![vec![Colour::Black; window.dimensions().x()]; window.dimensions().y()],
data: vec![
vec![Colour::Black; window.dimensions().x()];
window.dimensions().y()
],
window,
}
}
pub fn render(&self) -> Result<(), RenderError> {
let data: Vec<&[Colour]> = self.data.iter().map(|v| v.as_slice()).collect::<Vec<_>>();
let data: Vec<&[Colour]> =
self.data.iter().map(|v| v.as_slice()).collect::<Vec<_>>();
self.window
.render(data.as_slice())
.map_err(|_| RenderError::Generic)
}
pub fn write_pixel(&mut self, x: usize, y: usize, color: Colour) -> Result<(), RenderError> {
if x >= self.window.dimensions().x() || y >= self.window.dimensions().y() {
pub fn write_pixel(
&mut self,
x: usize,
y: usize,
color: Colour,
) -> Result<(), RenderError> {
if x >= self.window.dimensions().x()
|| y >= self.window.dimensions().y()
{
return Err(RenderError::Generic);
}
self.data[y][x] = color;