-
Notifications
You must be signed in to change notification settings - Fork 178
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
Reinvent icu_pattern with support for multiple backends #4610
Conversation
Some notes from diving deeper into this with @robertbastian @Manishearth:
placeholder 1 at index 10 [(usize,usize);N] [(usize, &dyn Writeable)] "AA{1}{0}BB" (p1, i2) (p0, i2) p1 p2 (0x21, 0x20) "AABB"
|
Co-authored-by: Robert Bastian <[email protected]>
The conflict is from 17f2cb0. Accepting mine. |
let placeholder_offset_char = store.chars().next().ok_or(Error::InvalidPattern)?; | ||
let initial_offset = char::len_utf8(placeholder_offset_char); | ||
let placeholder_offset = placeholder_offset_char as usize; | ||
if placeholder_offset > store.len() - initial_offset + 1 { |
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.
Ah I see.
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.
lgtm! Thanks for picking it up!
After experimenting with this for some time, it's clear that there is not a single storage solution that works optimally for every use case. I have therefore proceeded to make
Pattern
generic over its backend. This leads to cleaner, more flexible code.In this initial PR, I added support for a straightforward and efficient backend
SinglePlaceholder
. I will follow up with additional backends in future PRs.Replaces #4579