Skip to content

Commit

Permalink
write_fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mokurin000 committed Feb 1, 2024
1 parent 402558f commit 3eeb544
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/search.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::Write;

use url::Url;

use crate::QQMusicApi;
Expand Down Expand Up @@ -25,12 +27,12 @@ impl Search for QQMusicApi {
let mut query = format!("key={key}&t={}", T::TYPE_ID);

if let Some(page_num) = page_num {
query += "&pageNo=";
query += &page_num.to_string();
query.write_fmt(format_args!("&pageNo={page_num}")).unwrap();
}
if let Some(page_size) = page_size {
query += "&pageSize=";
query += &page_size.to_string();
query
.write_fmt(format_args!("&pageSize={page_size}"))
.unwrap();
}

url.set_query(Some(&query));
Expand All @@ -49,9 +51,9 @@ macro_rules! search_type {
}

pub trait SearchType {
const TYPE_ID: u32;
type Resp;
}
const TYPE_ID: u32;
type Resp;
}

search_type!(Track, 0, TrackSearchResp);

Expand Down

0 comments on commit 3eeb544

Please sign in to comment.