cargo check fix

This commit is contained in:
Yegor Bayev 2022-01-10 20:06:05 +03:00
parent dc615dbc57
commit b1987ec963
3 changed files with 33 additions and 22 deletions

View File

@ -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<SessionGroup>, is_info: bool) -> Result<(), Error> {
async fn run_inner(
opts: Opts,
session_group: Arc<SessionGroup>,
is_info: bool,
) -> Result<(), Error> {
let stop = tokio::signal::ctrl_c();
let creds = super::creds(opts.src.username, opts.src.password);

View File

@ -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),

View File

@ -62,7 +62,10 @@ struct ReceivedMessage {
msg: Message<Bytes>,
}
pub fn fmt_option<T>(opt: &Option<T>) -> String where T: std::fmt::Display {
pub fn fmt_option<T>(opt: &Option<T>) -> String
where
T: std::fmt::Display,
{
match opt {
Some(x) => x.to_string(),
None => "None".to_string(),