| 1 | // Take a look at the license at the top of the repository in the LICENSE file. |
| 2 | |
| 3 | use std::fmt; |
| 4 | |
| 5 | use crate::Stream; |
| 6 | |
| 7 | impl Stream { |
| 8 | pub fn debug(&self) -> Debug { |
| 9 | Debug(self) |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | pub struct Debug<'a>(&'a Stream); |
| 14 | |
| 15 | impl fmt::Debug for Debug<'_> { |
| 16 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 17 | f&mut DebugStruct<'_, '_>.debug_struct("Stream" ) |
| 18 | .field("stream_id" , &self.0.stream_id()) |
| 19 | .field("stream_type" , &self.0.stream_type()) |
| 20 | .field("stream_flags" , &self.0.stream_flags()) |
| 21 | .field("caps" , &self.0.caps()) |
| 22 | .field(name:"tags" , &self.0.tags()) |
| 23 | .finish() |
| 24 | } |
| 25 | } |
| 26 | |