mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-01-19 00:44:03 +01:00
Modify GetToken::token.
Change it to accept an iterator of items that can be converted to `String`s rather than an iterator of items that can be referenced as `&str`s. Primarily this allows it to be called with a larger variety of inputs. For example ::std::env::args().skip(1) can now be passed directly to token, where before it would first need to be collected into a vector. Since all implementations unconditionally collected the iterator into a vector this shouldn't have any negative impact on performance and should actually reduce the number of allocations in some uses. It simplifies the signature since the lifetime bounds are no longer required.
This commit is contained in:
@@ -240,13 +240,13 @@ impl FromStr for Scheme {
|
||||
/// The `api_key()` method is an alternative in case there are no scopes or
|
||||
/// if no user is involved.
|
||||
pub trait GetToken {
|
||||
fn token<'b, I, T>(
|
||||
fn token<I, T>(
|
||||
&mut self,
|
||||
scopes: I,
|
||||
) -> Box<dyn Future<Item = Token, Error = RequestError> + Send>
|
||||
where
|
||||
T: AsRef<str> + Ord + 'b,
|
||||
I: Iterator<Item = &'b T>;
|
||||
T: Into<String>,
|
||||
I: IntoIterator<Item = T>;
|
||||
|
||||
fn api_key(&mut self) -> Option<String>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user