Skip to content

Commit

Permalink
Merge pull request #158 from george-hopkins/returnval
Browse files Browse the repository at this point in the history
Pass return values of view callbacks
  • Loading branch information
GuillaumeGomez authored Oct 14, 2024
2 parents 4247546 + 262cbaf commit 9e148b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/types/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ impl<'a> [<$rust_name View>]<'a> {
}
}

pub fn matrix<F: FnOnce(Option<&$rust_name>)>(&self, f: F) {
pub fn matrix<F: FnOnce(Option<&$rust_name>) -> R, R>(&self, f: F) -> R {
let tmp = &self.mat.matrix;
let tmp_mat = $rust_name::soft_wrap(tmp as *const _ as usize as *mut _);
if tmp_mat.is_ptr_null() {
Expand All @@ -698,7 +698,7 @@ impl<'a> [<$rust_name View>]<'a> {
}
}

pub fn matrix_mut<F: FnOnce(Option<&mut $rust_name>)>(&mut self, f: F) {
pub fn matrix_mut<F: FnOnce(Option<&mut $rust_name>) -> R, R>(&mut self, f: F) -> R {
let tmp = &mut self.mat.matrix;
let mut tmp_mat = $rust_name::soft_wrap(tmp as *mut _);
if tmp_mat.is_ptr_null() {
Expand Down

0 comments on commit 9e148b5

Please sign in to comment.