Commit graph

7 commits

Author SHA1 Message Date
Jonas Schäfer
2e9c9411a3 jid: rewrite public types
This moves InnerJid into Jid and reformulates BareJid and FullJid in
terms of Jid.

Doing this has the key advantage that FullJid and BareJid can deref to
and borrow as Jid. This, in turn, has the advantage that they can be
used much more flexibly in HashMaps. However, this is (as we say in
Germany) future music; this commit only does the internal reworking.

Oh and also, it saves 20% memory on Jid objects.

Fixes #122 more thoroughly, or rather the original intent behind it.
2024-04-15 18:21:24 +02:00
Jonas Schäfer
9608b59f60 Add more conversion/construction paths between Jid and part types 2024-03-10 10:51:53 +01:00
Jonas Schäfer
7fce1146e0 Offer {Resource,Node,Domain}Ref on Jid API
This provides a non-copying API, which is generally favourable. The
other accessors were removed, because the intent was to provide this
"most sensible" API via the "default" (i.e. shortest, most concisely
named) functions.
2024-03-10 10:51:01 +01:00
Jonas Schäfer
8238e81c66 Unify declaration of {Node,Domain,Resource}Part
This introduces a str-like type for each of these, which will allow
returning a ref instead of the copied data from various methods in
{Full,Bare}Jid.

The use of a macro ensures that all types are declared consistently.
2024-03-09 09:00:22 +01:00
xmppftw
119c04801c Fix cargo doc warnings in jid crate 2023-12-16 17:19:11 +01:00
xmppftw
4266368a98 JIDs now have typed and stringy methods for node/domain/resource access
Jid now has typed with_resource and stringy with_resource_str
Jid now has is_full, is_bare
2023-06-21 18:30:25 +02:00
xmppftw
199b3ae7ae Introduce typed Parts for the JID to enable unfallible JID construction 2023-06-21 14:15:03 +02:00