-
Notifications
You must be signed in to change notification settings - Fork 183
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
Moving complex segmenter logic into complex
module
#3349
Conversation
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.
Mostly just moving things around. Seems fine
dict: &'l UCharDictionaryBreakDataV1<'l>, | ||
grapheme: &'l RuleBreakDataV1<'l>, | ||
} | ||
|
||
impl<'l> DictionarySegmenter<'l> { | ||
pub fn new( | ||
pub(super) fn new( | ||
dict: &'l DataPayload<UCharDictionaryBreakDataV1Marker>, |
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.
Nit (optional): Can you use this PR to address my unresolved comment from #3348
Nit: You should almost never have a
&'a DataPayload<FooV1Marker>
you should instead have a
&'a FooV1<'a>
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 don't think this is the place
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.
Actually in this instance it really complicates things. Instead of being able to .map(Result::as_ref)
I'd have to have a map
that unpacks both values, and have that be conditional on the LSTM being the never type.
self.data | ||
} | ||
|
||
pub fn copy_submatrix<const M: usize>(&mut self, from: usize, to: usize) { | ||
pub(super) fn copy_submatrix<const M: usize>(&mut self, from: usize, to: usize) { |
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.
Nit: It seems more verbose to do this to all the methods. If you want to be explicit that it is pub(super),just label the class as such, not the individual methods on the class
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 prefer it that way, because it makes the semver relevance clearer without hunting for the struct's definition.
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.
🤷♂️
Based on #3348
Makes it clearer where the modules are used, and makes a whole lot of types more private.