Commit graph

5 commits

Author SHA1 Message Date
Emmanuel Gil Peyrot
48f77acb69 jid: Make the crate no_std
Only std::error::Error is missing in this mode, but that’s only waiting
for its stabilisation, see this issue:
https://github.com/rust-lang/rust/issues/103765
2024-05-04 10:28:25 +00:00
Emmanuel Gil Peyrot
ccf41fc1e8 jid: Rename errors to make them more consistent 2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
1904f0af6c jid: Rename error into Error
JidParseError is an ok name when imported elsewhere, but inside of this
crate it makes much more sense to name it Error.
2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
cf25bd3fee jid: Refactor all three JID types
The main reason for this refactor was to make common operations simpler,
for instance formatting a JID is now a simple clone of a String.

Instead of having three different String for each of node, domain and
resource, we now have a single String with offsets pointing to where the
at and slash are (if they are present).

This also reduces the size of a FullJid from 72 bytes to 32 bytes on
64-bit platforms (less so on 32-bit), and BareJid from 48 bytes to
32 bytes.  Jid is still 40 bytes instead of 32, but that can be improved
in a future version where InnerJid has been inlined into each struct.
2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
187e156b0b jid: Move JidParseError into its own module 2023-06-20 18:59:26 +02:00