#xmpp #part

jid

A crate which provides a Jid struct for Jabber IDs

29 releases

Uses new Rust 2024

new 0.12.3 Jun 11, 2026
0.12.2 Feb 26, 2026
0.12.1 Nov 2, 2025
0.12.0 Feb 24, 2025
0.1.0 Feb 27, 2017

#310 in Network programming

Download history 628/week @ 2026-02-25 896/week @ 2026-03-04 864/week @ 2026-03-11 1086/week @ 2026-03-18 1383/week @ 2026-03-25 1082/week @ 2026-04-01 1482/week @ 2026-04-08 2667/week @ 2026-04-15 2234/week @ 2026-04-22 1565/week @ 2026-04-29 1747/week @ 2026-05-06 2041/week @ 2026-05-13 1264/week @ 2026-05-20 1246/week @ 2026-05-27 1264/week @ 2026-06-03 1093/week @ 2026-06-10

5,246 downloads per month
Used in 16 crates (6 directly)

MPL-2.0 license

89KB
2K SLoC

jid

What's this?

A crate which provides a struct Jid for Jabber IDs. It's used in xmpp-rs but other XMPP libraries can of course use this.

What license is it under?

MPL-2.0 or later, see the LICENSE file.

Notes

This library does not yet implement RFC7622.


lib.rs:

Represents XMPP addresses, also known as JabberIDs (JIDs) for the XMPP protocol. A [Jid] can have between one and three parts in the form node@domain/resource:

  • the (optional) node part designates a specific account/service on a server, for example username@server.com
  • the domain part designates a server, for example irc.jabberfr.org
  • the (optional) resource part designates a more specific client, such as a participant in a groupchat (jabberfr@chat.jabberfr.org/user) or a specific client device associated with an account (user@example.com/dino)

The [Jid] enum can be one of two variants, containing a more specific type:

  • BareJid (Jid::Bare variant): a JID without a resource
  • FullJid (Jid::Full variant): a JID with a resource

Jids as per the XMPP protocol only ever contain valid UTF-8. However, creating any form of Jid can fail in one of the following cases:

  • wrong syntax: creating a Jid with an empty (yet declared) node or resource part, such as @example.com or user@example.com/
  • stringprep error: some characters were invalid according to the stringprep algorithm, such as mixing left-to-write and right-to-left characters

Dependencies

~3–4.5MB
~88K SLoC