Skip to content

Implement `Borrow<str>` on JID types

Jonas Schäfer requested to merge jssfr/xmpp-rs:feature/jid-borrow-str into main

This allows, via as_str(), to look up any JID type within a HashMap or HashSet of any other JID type.

In an ideal world, we'd have proper ref types for the JIDs. Unfortunately, that's not really possible: we would need an dynamically sized type containing some data and then the string slice. Such a type can be defined, but not constructed in stable safe Rust. A type like FullJidRef<'_> would not suffice, because Borrow<T> requires to return a reference, not an owned value.

Fixes #122 (closed).

Merge request reports