mirror of
https://github.com/ivabus/matrix
synced 2024-12-04 22:15:07 +03:00
Update deps and fix some useless code
Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
This commit is contained in:
parent
2eca1003cf
commit
5448afe653
3 changed files with 12 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
||||||
use std::ops::{Add, AddAssign, Mul, MulAssign};
|
use std::ops::{Add, AddAssign, Mul};
|
||||||
|
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ fn check_valid<T>(a: &Matrix<T>) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sum<T: Add<Output = T> + Copy>(a: &Matrix<T>, b: &Matrix<T>) -> Option<Matrix<T>> {
|
pub fn sum<T: Add<Output = T> + Copy>(a: &Matrix<T>, b: &Matrix<T>) -> Option<Matrix<T>> {
|
||||||
if !(check_valid(&a) && check_valid(&b)) {
|
if !(check_valid(a) && check_valid(b)) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ pub fn mul<T: Mul<Output = T> + Copy + AddAssign + From<u8>>(
|
||||||
a: &Matrix<T>,
|
a: &Matrix<T>,
|
||||||
b: &Matrix<T>,
|
b: &Matrix<T>,
|
||||||
) -> Option<Matrix<T>> {
|
) -> Option<Matrix<T>> {
|
||||||
if !(check_valid(&a) && check_valid(&b)) {
|
if !(check_valid(a) && check_valid(b)) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ optimize = ["log/release_max_level_warn"]
|
||||||
default = ["optimize"]
|
default = ["optimize"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = "0.10"
|
env_logger = "0.10.0"
|
||||||
log = "0.4"
|
log = "0.4.17"
|
||||||
matrix = { version = "0.1.2", path = "../matrix" }
|
matrix = { version = "0.1.2", path = "../matrix" }
|
||||||
pixels = "0.11.0"
|
pixels = "0.11.0"
|
||||||
winit = "0.28.1"
|
winit = "0.28.2"
|
||||||
winit_input_helper = "0.14.0"
|
winit_input_helper = "0.14.0"
|
||||||
bresenham = "0.1.1"
|
bresenham = "0.1.1"
|
||||||
|
|
|
@ -107,16 +107,13 @@ fn main() {
|
||||||
let mut bitmap: [[bool; WIDTH as usize]; HEIGHT as usize] =
|
let mut bitmap: [[bool; WIDTH as usize]; HEIGHT as usize] =
|
||||||
[[false; WIDTH as usize]; HEIGHT as usize];
|
[[false; WIDTH as usize]; HEIGHT as usize];
|
||||||
event_loop.run(move |event, _, control_flow| {
|
event_loop.run(move |event, _, control_flow| {
|
||||||
match event {
|
if event == Event::MainEventsCleared {
|
||||||
Event::MainEventsCleared => {
|
render(pixels.get_frame_mut(), &bitmap);
|
||||||
render(pixels.get_frame_mut(), &bitmap);
|
if let Err(err) = pixels.render() {
|
||||||
if let Err(err) = pixels.render() {
|
error!("pixels.render() failed: {err}");
|
||||||
error!("pixels.render() failed: {err}");
|
*control_flow = ControlFlow::Exit;
|
||||||
*control_flow = ControlFlow::Exit;
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle input events
|
// Handle input events
|
||||||
|
|
Loading…
Reference in a new issue