-
-
Notifications
You must be signed in to change notification settings - Fork 423
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
Convenience methods for ServiceId #595
Conversation
Thanks! We discussed these and we think the (There may be a point in the future where ProtocolAddress requires a ServiceId instead of an arbitrary String, which would make this redundant. But that would mean changing a bunch of old tests written in the phone number days in all our app repos, so we're not rushing to do it.) |
Maybe @gferon wants to chip in on why these are useful; I ported them over from an extension trait in whisperfish/libsignal-service-rs#334
I would argue that as long as I'll happily drop the 4b37cd6 commit from this PR!
I think that makes sense, and this PR could be a first step towards it! |
Yeah, I can see the Copy thing. 17 bytes is right on the border of "is it a good idea to Copy this?", but apparently it still gets passed in registers, so maybe it's reasonable after all. We do have existing methods on ServiceId that use |
5ab0204
to
ee24618
Compare
My mental threshold is somewhere between 16 and 32 bytes, but that's based on nothing really.
Very device dependent, I'd say. ARMv9 and x86, sure, but I wouldn't necessarily bet on armv7 to always pass this through registers if other variables are hot too.
That's fair enough. I made it I also dropped the aci/pni methods, because |
Cherry-picked into our private branch and will be included in the next release! |
Great, thanks :-) I'll try to remove our extension trait altogether, and suggest all users to just use |
Included in v0.62.0! |
This rewires some APIs to accept DeviceId instead of u32. It also removes the ServiceIdExt trait, since signalapp/libsignal#595 got merged. The `aci()` and `pni()` methods can be replaced with simple `into()` or `from()` calls, depending on context.
These are some convenience methods that make working with ServiceId and ProtocolAddress a tiny bit more convenient. I haven't been able to find use cases in the libsignal-protocol stack itself, but I haven't looked very thoroughly either.