-
Notifications
You must be signed in to change notification settings - Fork 164
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
feat: named table data as DataRef
type
#464
Conversation
Extracted table metadata retrieval into a separate function `get_table_meta` for code reuse and clarity. This change simplifies the `table_by_name` function and introduces a new `table_by_name_ref` function that also leverages the shared `get_table_meta` functionality.
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.
Thanks!
Small comments to keep it as generic as possible.
src/lib.rs
Outdated
@@ -932,13 +932,13 @@ impl<'a, T: 'a + CellType> DoubleEndedIterator for Rows<'a, T> { | |||
impl<'a, T: 'a + CellType> ExactSizeIterator for Rows<'a, T> {} | |||
|
|||
/// Struct with the key elements of a table | |||
pub struct Table<T> { | |||
pub struct Table<T: CellType> { |
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 think it is better to refrain from adding constraints on the structs, the impl are enough, more generic and more future proof.
src/lib.rs
Outdated
pub(crate) name: String, | ||
pub(crate) sheet_name: String, | ||
pub(crate) columns: Vec<String>, | ||
pub(crate) data: Range<T>, | ||
} | ||
impl<T> Table<T> { | ||
impl<T: CellType> Table<T> { |
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.
Same here, it is unnecessary I think.
@tafia Is there anything else you need me to change in this PR? |
Sorry for the late answer lgtm! |
During some work I was performing on a MR for
fastexcel
(ToucanToco/fastexcel#282) I noticed no method for retrievingTable
s withDataRef
as inner type was not possible. This MR should hopefully resolve this issue.I also implemented
From<Table<T>>
forRange<T>
to prevent large clone operations, which I ran into in one method in particular insidefastexcel
.Finally I resolved a small
clippy
warning mentioning thatstd::u32::MAX
is deprecated.Eager to receive your feedback :)