diff --git a/examples/client/metadata.rs b/examples/client/metadata.rs index fa3d52a..67f3438 100644 --- a/examples/client/metadata.rs +++ b/examples/client/metadata.rs @@ -23,7 +23,11 @@ pub async fn run(opts: Opts, is_info: bool) -> Result<(), Error> { r } -async fn run_inner(opts: Opts, session_group: Arc, is_info: bool) -> Result<(), Error> { +async fn run_inner( + opts: Opts, + session_group: Arc, + is_info: bool, +) -> Result<(), Error> { let stop = tokio::signal::ctrl_c(); let creds = super::creds(opts.src.username, opts.src.password); diff --git a/src/client/mod.rs b/src/client/mod.rs index b2cb17f..a1b6795 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -25,8 +25,8 @@ use url::Url; use crate::client::parse::SessionHeader; use crate::codec::CodecItem; -use crate::{Error, ErrorInt, RtspMessageContext}; use crate::fmt_option; +use crate::{Error, ErrorInt, RtspMessageContext}; mod channel_mapping; mod parse; @@ -598,32 +598,36 @@ pub struct Stream { impl std::fmt::Display for Stream { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let udp: String = match &self.sockets { - Some(x) => format!(concat!( - "\n", - " local ip: {}\n", - " local port: {}\n", - " remote ip: {}\n", - " remote rtp port: {}\n", - " remote rtcp port: {}", + Some(x) => format!( + concat!( + "\n", + " local ip: {}\n", + " local port: {}\n", + " remote ip: {}\n", + " remote rtp port: {}\n", + " remote rtcp port: {}", ), &x.local_ip, &x.local_rtp_port, &x.remote_ip, &x.remote_rtp_port, - &x.remote_rtcp_port), + &x.remote_rtcp_port + ), None => "None".to_string(), }; - write!(f, concat!( - "Stream:\n", - " media: {}\n", - " url: {}\n", - " encoding name: {}\n", - " RTP payload time: {}\n", - " clock rate: {}\n", - " channels: {}\n", - " depacketizer: {:#?}\n", - " UDP: {}\n", - " stream state: {:?}", + write!( + f, + concat!( + "Stream:\n", + " media: {}\n", + " url: {}\n", + " encoding name: {}\n", + " RTP payload time: {}\n", + " clock rate: {}\n", + " channels: {}\n", + " depacketizer: {:#?}\n", + " UDP: {}\n", + " stream state: {:?}", ), &self.media, fmt_option(&self.control), diff --git a/src/lib.rs b/src/lib.rs index 95f5342..87bda3d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -62,7 +62,10 @@ struct ReceivedMessage { msg: Message, } -pub fn fmt_option(opt: &Option) -> String where T: std::fmt::Display { +pub fn fmt_option(opt: &Option) -> String +where + T: std::fmt::Display, +{ match opt { Some(x) => x.to_string(), None => "None".to_string(),