-
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
Replace string
crate with a handrolled type
#44
Conversation
Is this unsafety worth it? It's not a ton of code...
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, this is really straightforward and seems like a great improvement. Will you just remove string
from our deps?
#[derive(Clone, Hash, Ord, PartialOrd, PartialEq, Eq, Default)] | ||
pub struct StrBytes(Bytes); | ||
|
||
impl StrBytes { |
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.
Wondering if we also want to provide unchecked constructors, although perhaps it's best to proceed with the entirely safe API first and see if anyone has a need for them later.
Also @bkirwi It looks like your first commit got clobbered by the second. I'm not seeing the topic name changes in the diff. |
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 a lot, the old string type was causing us all sorts of problems.
I didnt think to replace it!
I've checked
Apologies - this was semi-intentional, and I should have called it out! We get the It looks like I have a merge conflict here... I should be able to address it in the next few days, but feel free to push to the branch if you'd rather push this through sooner! |
Ope! Somehow missed that. Apologies.
It's not too bad at all, but I definitely think |
🎉 this is great! It has also been a major ergonomics issue for me as well! |
Addresses: #43
TopicName
helpers that make it easier to convert to/from normal string types.The second commit involves a small bit of unsafe code. If that's a problem for us, there are options to remove it (at some possible runtime cost) which we could discuss. But maybe it's fine? I'm personally a bit split on it.