mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-04-27 15:34:51 +00:00
sdp: Implement a proper Debug impl on SDPMedia
This commit is contained in:
parent
30950917a0
commit
b6f569d049
1 changed files with 23 additions and 2 deletions
|
@ -89,8 +89,29 @@ pub struct SDPMediaRef(ffi::GstSDPMedia);
|
||||||
|
|
||||||
impl fmt::Debug for SDPMediaRef {
|
impl fmt::Debug for SDPMediaRef {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
f.debug_tuple("SDPMedia")
|
use std::cell::RefCell;
|
||||||
// TODO
|
|
||||||
|
struct DebugIter<I>(RefCell<I>);
|
||||||
|
impl<I: Iterator> fmt::Debug for DebugIter<I>
|
||||||
|
where
|
||||||
|
I::Item: fmt::Debug,
|
||||||
|
{
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
f.debug_list().entries(&mut *self.0.borrow_mut()).finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f.debug_struct("SDPMedia")
|
||||||
|
.field("formats", &DebugIter(RefCell::new(self.formats())))
|
||||||
|
.field("connections", &DebugIter(RefCell::new(self.connections())))
|
||||||
|
.field("bandwidths", &DebugIter(RefCell::new(self.bandwidths())))
|
||||||
|
.field("attributes", &DebugIter(RefCell::new(self.attributes())))
|
||||||
|
.field("information", &self.get_information())
|
||||||
|
.field("key", &self.get_key())
|
||||||
|
.field("media", &self.get_media())
|
||||||
|
.field("port", &self.get_port())
|
||||||
|
.field("num-ports", &self.get_num_ports())
|
||||||
|
.field("proto", &self.get_proto())
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue