From 0a5892c67fb02e09a621ac8796ac84232935f5c3 Mon Sep 17 00:00:00 2001 From: David Blajda Date: Wed, 30 Jan 2019 20:34:54 +0000 Subject: Use ToString for endpoint params --- src/helix/namespaces/users.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/helix/namespaces/users.rs') diff --git a/src/helix/namespaces/users.rs b/src/helix/namespaces/users.rs index 20f2914..2e922d6 100644 --- a/src/helix/namespaces/users.rs +++ b/src/helix/namespaces/users.rs @@ -1,13 +1,12 @@ use super::*; use super::models::{DataContainer, User}; -use crate::types::UserId; +use std::string::ToString; pub struct Users {} type UsersNamespace = Namespace; impl UsersNamespace { - pub fn users(self, ids: Vec<&UserId>, logins: Vec<&str>) - -> ApiRequest> { + pub fn users(self, ids: &[S], logins: &[S]) -> ApiRequest> { use self::users; users(self.client, ids, logins) } @@ -19,18 +18,18 @@ impl Client { } } -pub fn users( +pub fn users( client: Client, - ids: Vec<&UserId>, - logins: Vec<&str>, + ids: &[S], + logins: &[S], ) -> ApiRequest> { let client = client.inner; let url = String::from("https://") + client.domain() + &String::from("/helix/users"); - let mut params = BTreeMap::new(); + let mut params: BTreeMap<&str, &dyn ToString> = BTreeMap::new(); for id in ids { - params.insert("id", id.as_ref()); + params.insert("id", id); } for login in logins { @@ -41,5 +40,5 @@ pub fn users( } pub fn authed_as(client: Client) -> ApiRequest> { - users(client, Vec::with_capacity(0), Vec::with_capacity(0)) + users(client, &[""], &[""]) } -- cgit v1.2.3