-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Row and column slice getter #55
base: master
Are you sure you want to change the base?
Conversation
@becheran Any chance this can be merged sometime soon? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all thanks for openening a PR.
I don't understand why those additional function whould make the library more useful? Especially because all function only work properly in one of the two modes.
let start = row_usize * self.cols; | ||
Some(self.data[start..(start + self.cols)].as_ref()) | ||
} else { | ||
None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look at the changes. Thanks for the formatting. I better setup my auto-formatter better.
I wonder if the implementaiton helps or is more confusing. I don't think it is a good idea to expose a function called get_row
which only works in RowMajor
mode.
Why not use the already existing iter_row
funciton instead and let the caller decide if collecting the result into a Vec
is desired?
Adds
get_row
andget_col
functions to access the corresponding underlying slice of a selected row/column, returningNone
if out of bounds or if the values are not contiguous (e.g., a row from a grid inOrder::ColumnMajor
or a column from a grid inOrder::RowMajor
).Equivalent mutable methods
get_mut_row
andget_mut_col
.EXTRA: some quick linter fixes.