autoformatting

This commit is contained in:
markichnich 2024-03-21 22:02:09 +01:00
parent 561d6f52c4
commit 0e2308b472

View File

@ -140,26 +140,27 @@ where
} }
pub fn map<F>(&self, f: F) -> Mat<T> pub fn map<F>(&self, f: F) -> Mat<T>
where F: FnMut(T) -> T where
F: FnMut(T) -> T,
{ {
Mat { Mat {
rows: self.rows, cols: self.cols, rows: self.rows,
data: self.data.clone() cols: self.cols,
.into_iter() data: self.data.clone().into_iter().map(f).collect(),
.map(f)
.collect()
} }
} }
} }
pub trait Collect<T> pub trait Collect<T>
where T: MatElem, where
T: MatElem,
{ {
fn collect_mat(self, rows: usize, cols: usize) -> Mat<T>; fn collect_mat(self, rows: usize, cols: usize) -> Mat<T>;
} }
impl<T> Collect<T> for T impl<T> Collect<T> for T
where T: MatElem + std::iter::IntoIterator<Item = T> where
T: MatElem + std::iter::IntoIterator<Item = T>,
{ {
fn collect_mat(self, rows: usize, cols: usize) -> Mat<T> { fn collect_mat(self, rows: usize, cols: usize) -> Mat<T> {
let data = self.into_iter().collect::<Vec<T>>(); let data = self.into_iter().collect::<Vec<T>>();