Skip to content

Commit 576004d

Browse files
committed
works?
1 parent 2396da2 commit 576004d

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

src/helix/client.rs

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ impl<'a, C: crate::HttpClient<'a>> HelixClient<'a, C> {
110110
ClientRequestError<<C as crate::HttpClient<'a>>::Error>,
111111
>
112112
where
113-
for<'y> R: Request<Response<'y> = D> + RequestGet,
113+
R: Request<Response<'static> = D> + RequestGet,
114114
D: for<'b> serde::de::Deserialize<'b> + for<'b> yoke::Yokeable<'b, Output = D> + PartialEq,
115-
D: 'static,
116115
T: TwitchToken + ?Sized,
117116
C: Send,
118117
{
@@ -131,28 +130,27 @@ impl<'a, C: crate::HttpClient<'a>> HelixClient<'a, C> {
131130
let mut request_opt = None;
132131
let mut total = None;
133132
let mut other = None;
134-
let resp: yoke::Yoke<<R as Request>::Response<'static>, _> =
135-
yoke::Yoke::try_attach_to_cart(
136-
body,
137-
|body| -> Result<
138-
<D as yoke::Yokeable<'_>>::Output,
139-
ClientRequestError<<C as crate::HttpClient<'a>>::Error>,
140-
> {
141-
let response = http::Response::from_parts(parts, body);
142-
let Response {
143-
data,
144-
pagination: pagination_inner,
145-
request: request_inner,
146-
total: total_inner,
147-
other: other_inner,
148-
} = <R>::parse_response(Some(request), &uri, &response)?;
149-
pagination = pagination_inner;
150-
request_opt = request_inner;
151-
total = total_inner;
152-
other = other_inner;
153-
Ok(data)
154-
},
155-
)?;
133+
let resp: yoke::Yoke<D, _> = yoke::Yoke::try_attach_to_cart(
134+
body,
135+
|body| -> Result<
136+
<D as yoke::Yokeable<'static>>::Output,
137+
ClientRequestError<<C as crate::HttpClient<'a>>::Error>,
138+
> {
139+
let response = http::Response::from_parts(parts, body);
140+
let Response {
141+
data,
142+
pagination: pagination_inner,
143+
request: request_inner,
144+
total: total_inner,
145+
other: other_inner,
146+
} = todo!();//<R>::parse_response(Some(request), &uri, &response)?;
147+
pagination = pagination_inner;
148+
request_opt = request_inner;
149+
total = total_inner;
150+
other = other_inner;
151+
Ok(data)
152+
},
153+
)?;
156154

157155
Ok(Response {
158156
data: resp,

src/helix/request.rs

Lines changed: 2 additions & 2 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>: serde::de::Deserialize<'a> + PartialEq;
21+
type Response<'a>: serde::de::Deserialize<'a> + PartialEq + 'a;
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.
@@ -396,7 +396,7 @@ pub trait RequestGet: Request {
396396
response: &'b http::Response<&'a [u8]>,
397397
) -> Result<Response<Self, <Self as Request>::Response<'a>>, HelixRequestGetError>
398398
where
399-
Self: Sized,
399+
Self: Sized + 'a,
400400
{
401401
let text = std::str::from_utf8(response.body()).map_err(|e| {
402402
HelixRequestGetError::Utf8Error(response.body().to_vec(), e, uri.clone())

0 commit comments

Comments
 (0)