Change
From<&Jid> for Jid is now implemented in wacore-binary. All mutating public methods that previously took either Jid (by value) or &Jid (by reference) now take impl Into<Jid> uniformly.
This covers the full public surface: send_message, forward_message, send_message_with_options, edit_message, edit_message_encrypted, revoke_message, keep_message, pin_message, unpin_message, send_reaction, and all 53 feature methods across Groups (26), Community (6), Newsletter (2), Presence (1), Polls, Events, Comments, and Reactions.
Before
After
How it works
From<&Jid> for Jid clones the JID. For borrow-callers this is one allocation; for typical phone-number JIDs the user part is stored inline (up to 24 bytes via CompactString), making the clone heap-free.
Owned callers continue to move the value at zero cost. Both forms are pinned by the new jid_into_convention compile-time guard in the test suite.
Monomorphization discipline: Large async state machines (send_message_with_options, edit_message, edit_message_encrypted, revoke_message) keep a monomorphic _inner behind a thin generic shim that only does .into(), so each Into<Jid> instantiation cannot duplicate the full state machine.
Breaking changes
Pre-1.0 signature change. All converted methods now declareimpl Into<Jid> in their public signature.
- Owned callers (
jidby value) — compile unchanged. - Borrow callers (
&jid) — compile unchanged viaFrom<&Jid>. - Trait-object / fn-pointer uses of these inherent methods (e.g.
let f: fn(&Client, Jid, ...) = Client::send_message) — need a wrapping closure, sinceimpl Traitparameters are not compatible with concrete fn-pointer types. This is an uncommon pattern for inherent async methods.
Deliberate exceptions
Read-only methods keep&Jid. Converting them would force a clone on every borrow-caller for no benefit. ~59 query methods (query_info, get_metadata, etc.) are unchanged.
&[Jid] slices and Option<&Jid> parameters are also out of scope.