tokio-xmpp: derive Debug on multiple structures

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2025-03-26 21:54:59 +01:00
commit 6fe7f92e7d
4 changed files with 9 additions and 0 deletions

View file

@ -39,6 +39,7 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
Future. Future.
- `rustls` is now re-exported if it is enabled, to allow applications to - `rustls` is now re-exported if it is enabled, to allow applications to
set the default crypto provider if needed. (!581) set the default crypto provider if needed. (!581)
- Derive Debug on Client and associated structs
* Changes: * Changes:
- On Linux, once the TLS session is established, we can delegate the - On Linux, once the TLS session is established, we can delegate the
actual encryption and decryption to the kernel, which in turn can actual encryption and decryption to the kernel, which in turn can

View file

@ -31,6 +31,7 @@ use crate::{
}; };
/// An IQ request payload /// An IQ request payload
#[derive(Debug)]
pub enum IqRequest { pub enum IqRequest {
/// Payload for a `type="get"` request /// Payload for a `type="get"` request
Get(Element), Get(Element),
@ -49,6 +50,7 @@ impl From<IqRequest> for IqType {
} }
/// An IQ response payload /// An IQ response payload
#[derive(Debug)]
pub enum IqResponse { pub enum IqResponse {
/// Payload for a `type="result"` response. /// Payload for a `type="result"` response.
Result(Option<Element>), Result(Option<Element>),
@ -102,6 +104,7 @@ impl Error for IqFailure {
type IqKey = (Option<Jid>, String); type IqKey = (Option<Jid>, String);
type IqMap = BTreeMap<IqKey, IqResponseSink>; type IqMap = BTreeMap<IqKey, IqResponseSink>;
#[derive(Debug)]
struct IqMapEntryHandle { struct IqMapEntryHandle {
key: IqKey, key: IqKey,
map: Weak<Mutex<IqMap>>, map: Weak<Mutex<IqMap>>,
@ -134,6 +137,7 @@ pin_project_lite::pin_project! {
/// ///
/// Dropping (cancelling) an `IqResponseToken` removes the internal /// Dropping (cancelling) an `IqResponseToken` removes the internal
/// bookkeeping required for tracking the response. /// bookkeeping required for tracking the response.
#[derive(Debug)]
pub struct IqResponseToken { pub struct IqResponseToken {
entry: Option<IqMapEntryHandle>, entry: Option<IqMapEntryHandle>,
#[pin] #[pin]
@ -217,6 +221,7 @@ impl Future for IqResponseToken {
} }
} }
#[derive(Debug)]
struct IqResponseSink { struct IqResponseSink {
inner: oneshot::Sender<Result<IqResponse, IqFailure>>, inner: oneshot::Sender<Result<IqResponse, IqFailure>>,
} }
@ -228,6 +233,7 @@ impl IqResponseSink {
} }
/// Utility struct to track IQ responses. /// Utility struct to track IQ responses.
#[derive(Debug)]
pub struct IqResponseTracker { pub struct IqResponseTracker {
map: Arc<Mutex<IqMap>>, map: Arc<Mutex<IqMap>>,
} }

View file

@ -36,6 +36,7 @@ pub use iq::{IqFailure, IqRequest, IqResponse, IqResponseToken};
/// ///
/// To send stanzas, the [`send_stanza`][`Client::send_stanza`] method can be /// To send stanzas, the [`send_stanza`][`Client::send_stanza`] method can be
/// used. /// used.
#[derive(Debug)]
pub struct Client { pub struct Client {
stream: StanzaStream, stream: StanzaStream,
bound_jid: Option<Jid>, bound_jid: Option<Jid>,

View file

@ -90,6 +90,7 @@ pub enum Event {
} }
/// Frontend interface to a reliable, always-online stanza stream. /// Frontend interface to a reliable, always-online stanza stream.
#[derive(Debug)]
pub struct StanzaStream { pub struct StanzaStream {
rx: mpsc::Receiver<Event>, rx: mpsc::Receiver<Event>,
tx: mpsc::Sender<QueueEntry>, tx: mpsc::Sender<QueueEntry>,