gstreamer: manually implement Debug on PromiseReply

The default implementation was not very useful:

PromiseReply(
    Promise {
        inner: Shared {
            inner: 0x00007ff108001090,
        },
    },
)
This commit is contained in:
Guillaume Desmottes 2022-08-24 12:02:16 +02:00 committed by Sebastian Dröge
parent a341b4972f
commit e229288ecd

View file

@ -150,7 +150,6 @@ unsafe impl Sync for Promise {}
#[derive(Debug)] #[derive(Debug)]
pub struct PromiseFuture(Promise, futures_channel::oneshot::Receiver<()>); pub struct PromiseFuture(Promise, futures_channel::oneshot::Receiver<()>);
#[derive(Debug)]
pub struct PromiseReply(Promise); pub struct PromiseReply(Promise);
impl std::future::Future for PromiseFuture { impl std::future::Future for PromiseFuture {
@ -196,6 +195,18 @@ impl Deref for PromiseReply {
} }
} }
impl std::fmt::Debug for PromiseReply {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut debug = f.debug_tuple("PromiseReply");
match self.0.get_reply() {
Some(reply) => debug.field(reply),
None => debug.field(&"<no reply>"),
}
.finish()
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;