Skip to content

Commit 3c5ce8b

Browse files
committed
this should be the most correct version
but it doesn't work
1 parent aaa7c54 commit 3c5ce8b

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/helix/client.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,17 @@ impl<'a, C: crate::HttpClient<'a>> HelixClient<'a, C> {
113113
/// # }
114114
/// # // fn main() {run()}
115115
/// ```
116-
pub async fn req_get<'t, R, D, T>(
116+
pub async fn req_get<R, D, D2, T>(
117117
&'a self,
118118
request: R,
119-
token: &'t T,
119+
token: &T,
120120
) -> Result<
121121
Response<R, yoke::Yoke<D, std::rc::Rc<[u8]>>>,
122122
ClientRequestError<<C as crate::HttpClient<'a>>::Error>,
123123
>
124124
where
125-
for<'r> R: Request + RequestGet<Response<'r> = D> + Request<Response<'r> = D>,
126-
for<'b> yoke::trait_hack::YokeTraitHack<<D as yoke::Yokeable<'b>>::Output>:
127-
serde::de::Deserialize<'b>,
128-
for<'b> D: PartialEq + yoke::Yokeable<'b, Output = D>,
125+
for<'r> R: RequestGet<Response<'r> = D2> + Request<Response<'r> = D2>,
126+
for<'d> D: yoke::Yokeable<'d, Output = D2> + 'static,
129127
T: TwitchToken + ?Sized,
130128
C: Send,
131129
{
@@ -148,7 +146,7 @@ impl<'a, C: crate::HttpClient<'a>> HelixClient<'a, C> {
148146
body,
149147
|body| -> Result<_, ClientRequestError<<C as crate::HttpClient<'a>>::Error>> {
150148
let response = http::Response::from_parts(parts, body);
151-
let Response::<_, <R as Request>::Response<'_>> {
149+
let Response {
152150
data,
153151
pagination: pagination_inner,
154152
request: request_inner,

src/helix/request.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub trait Request: serde::Serialize {
1818
#[cfg(feature = "twitch_oauth2")]
1919
const OPT_SCOPE: &'static [twitch_oauth2::Scope] = &[];
2020
/// Response type. twitch's response will deserialize to this.
21-
type Response<'a>: for<'de> serde::de::Deserialize<'de> + PartialEq + 'a;
21+
type Response<'a>: for<'de> serde::de::Deserialize<'de> + PartialEq;
2222
/// Defines layout of the url parameters.
2323
fn query(&self) -> Result<String, errors::SerializeError> { ser::to_string(self) }
2424
/// Returns full URI for the request, including query parameters.
@@ -385,11 +385,11 @@ pub trait RequestGet: Request {
385385
/// # Notes
386386
///
387387
/// Pass in the request to enable [pagination](Response::get_next) if supported.
388-
fn parse_response<'a, 'b>(
389-
request: Option<Self>,
388+
fn parse_response<'a, 'b, S: Request>(
389+
request: Option<S>,
390390
uri: &http::Uri,
391391
response: &'b http::Response<&'a [u8]>,
392-
) -> Result<Response<Self, <Self as Request>::Response<'a>>, HelixRequestGetError>
392+
) -> Result<Response<S, <Self as Request>::Response<'a>>, HelixRequestGetError>
393393
where
394394
Self: Sized,
395395
{
@@ -414,12 +414,12 @@ pub trait RequestGet: Request {
414414
}
415415

416416
/// Parse a response string into the response.
417-
fn parse_inner_response<'a>(
418-
request: Option<Self>,
417+
fn parse_inner_response<'a, S: Request>(
418+
request: Option<S>,
419419
uri: &http::Uri,
420420
response: &'a str,
421421
status: http::StatusCode,
422-
) -> Result<Response<Self, <Self as Request>::Response<'a>>, HelixRequestGetError>
422+
) -> Result<Response<S, <Self as Request>::Response<'a>>, HelixRequestGetError>
423423
where
424424
Self: Sized,
425425
{

0 commit comments

Comments
 (0)