mirror of
https://codeberg.org/demostf/api-client.git
synced 2026-06-03 08:34:15 +02:00
bit more flexible player filter
This commit is contained in:
parent
52a9542ac8
commit
59c2e5f76d
1 changed files with 4 additions and 4 deletions
|
|
@ -251,7 +251,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
struct PlayerList(Vec<u64>);
|
struct PlayerList(Vec<SteamID>);
|
||||||
|
|
||||||
impl Serialize for PlayerList {
|
impl Serialize for PlayerList {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
|
||||||
|
|
@ -260,7 +260,7 @@ impl Serialize for PlayerList {
|
||||||
{
|
{
|
||||||
self.0
|
self.0
|
||||||
.iter()
|
.iter()
|
||||||
.map(|steamid| format!("{}", steamid))
|
.map(|steamid| format!("{}", u64::from(*steamid)))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(",")
|
.join(",")
|
||||||
.serialize(serializer)
|
.serialize(serializer)
|
||||||
|
|
@ -282,9 +282,9 @@ impl ListParams {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_players(self, players: Vec<u64>) -> Self {
|
pub fn with_players<T: Into<SteamID>, I: IntoIterator<Item = T>>(self, players: I) -> Self {
|
||||||
ListParams {
|
ListParams {
|
||||||
players: PlayerList(players),
|
players: PlayerList(players.into_iter().map(Into::into).collect()),
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue