Commit graph

22 commits

Author SHA1 Message Date
Emmanuel Gil Peyrot
94b49e8d93 jid: Rename errors to make them more consistent 2023-06-20 18:10:31 +02:00
Emmanuel Gil Peyrot
9ff65ae77a 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 17:46:29 +02:00
xmppftw
af300a9a78 jid: Factorize length check for shorter code 2023-06-20 17:46:29 +02:00
Emmanuel Gil Peyrot
2ca4a61428 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 17:46:29 +02:00
Emmanuel Gil Peyrot
21cf7a8e9d jid: Move JidParseError into its own module 2023-06-19 23:58:46 +02:00
Emmanuel Gil Peyrot
8a787d07c0 jid: Replace icu with stringprep
This dependency is unmaintained, but it is written in pure Rust unlike
ICU, and doesn’t require a roundtrip through UTF-16, improving both
performances (perhaps?) and ease of compilation.
2023-06-19 23:57:54 +02:00
Emmanuel Gil Peyrot
9384fd7eeb jid: Test for the size of our structs
This shows how big JIDs are represented on the stack and in other
structs.
2023-06-19 23:25:48 +02:00
4701f6bb69 jid: Rename Error::IcuError into Error::Stringprep
Avoir the "Error Error" pattern, and also use Stringprep instead of ICU

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-07 17:29:05 +02:00
xmppftw
2cafecb004 JID stringprep errors return a JidParseError instead of panic (#84) 2023-06-07 17:29:00 +02:00
xmppftw
8d9288ffd7 Implement From<&Jid> for String (close #69) 2023-05-28 22:27:40 +02:00
xmppftw
ce255d9602 Jid (de)serialization now uses untagged representation (close #66) 2023-05-28 19:54:51 +02:00
a91157aa80
jid: Add feature alias 'stringprep'
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-01-15 21:44:04 +01:00
Emmanuel Gil Peyrot
6eb25755a3 WIP: Add ICU bindings for stringprep, idna2008 and spoof checker. 2022-09-16 11:10:52 +02:00
Astro
b6618ffa3d jid: Release 0.9.4 2022-07-13 20:50:10 +02:00
Emmanuel Gil Peyrot
10f173db91 jid: Release 0.9.3 2022-03-07 12:12:02 +01:00
Emmanuel Gil Peyrot
e8359cffdc jid, xmpp-parsers: Bump minidom. 2022-02-16 21:11:56 +01:00
Emmanuel Gil Peyrot
9891cc48ac jid: Fix the issues reported by clippy 2021-10-11 16:17:09 +02:00
Emmanuel Gil Peyrot
c94c95de0e jid: Release 0.9.2 2021-01-13 11:46:05 +01:00
Emmanuel Gil Peyrot
3e4b6b55c9 jid: Release 0.9.1 2021-01-13 00:33:26 +01:00
Emmanuel Gil Peyrot
3df447de97 jid: Implement PartialEq between Jid and BareJid/FullJid.
This can be useful at times.
2020-12-10 20:45:01 +01:00
b85aa29377
Finish removing 'rs' suffix in libs
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-07-15 10:49:50 +02:00
Emmanuel Gil Peyrot
714d850e69 Remove the -rs suffix of jid, minidom and xmpp
We know those are Rust libraries, no need to add it to the path.  This
synchronises their directory with the crate name, hopefully reducing
confusion.
2020-06-22 02:17:32 +02:00