+19
-19
libs/kasync/src/io.rs
+19
-19
libs/kasync/src/io.rs
···
9
9
use core::convert::Infallible;
10
10
use core::ops::{Deref, DerefMut};
11
11
use core::pin::Pin;
12
-
use core::task::{ready, Context, Poll};
12
+
use core::task::{Context, Poll, ready};
13
13
14
14
pub trait Read {
15
15
type Err: core::error::Error;
···
119
119
cx: &mut Context<'_>,
120
120
buf: &mut [u8],
121
121
) -> Poll<Result<usize, Self::Err>> {
122
-
self.poll_read(cx, buf)
122
+
self.get_mut().as_mut().poll_read(cx, buf)
123
123
}
124
124
125
125
fn poll_read_vectored(
···
127
127
cx: &mut Context<'_>,
128
128
bufs: &mut [&mut [u8]],
129
129
) -> Poll<Result<usize, Self::Err>> {
130
-
self.poll_read_vectored(cx, bufs)
130
+
self.get_mut().as_mut().poll_read_vectored(cx, bufs)
131
131
}
132
132
}
133
133
···
138
138
type Err = T::Err;
139
139
140
140
fn poll_read(
141
-
self: Pin<&mut Self>,
141
+
mut self: Pin<&mut Self>,
142
142
cx: &mut Context<'_>,
143
143
buf: &mut [u8],
144
144
) -> Poll<Result<usize, Self::Err>> {
145
-
self.poll_read(cx, buf)
145
+
Pin::new(&mut **self).poll_read(cx, buf)
146
146
}
147
147
148
148
fn poll_read_vectored(
149
-
self: Pin<&mut Self>,
149
+
mut self: Pin<&mut Self>,
150
150
cx: &mut Context<'_>,
151
151
bufs: &mut [&mut [u8]],
152
152
) -> Poll<Result<usize, Self::Err>> {
153
-
self.poll_read_vectored(cx, bufs)
153
+
Pin::new(&mut **self).poll_read_vectored(cx, bufs)
154
154
}
155
155
}
156
156
···
168
168
cx: &mut Context<'_>,
169
169
buf: &[u8],
170
170
) -> Poll<Result<usize, Self::Err>> {
171
-
self.poll_write(cx, buf)
171
+
self.get_mut().as_mut().poll_write(cx, buf)
172
172
}
173
173
174
174
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Err>> {
175
-
self.poll_flush(cx)
175
+
self.get_mut().as_mut().poll_flush(cx)
176
176
}
177
177
178
178
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Err>> {
179
-
self.poll_close(cx)
179
+
self.get_mut().as_mut().poll_close(cx)
180
180
}
181
181
182
182
fn poll_write_vectored(
···
184
184
cx: &mut Context<'_>,
185
185
bufs: &[&[u8]],
186
186
) -> Poll<Result<usize, Self::Err>> {
187
-
self.poll_write_vectored(cx, bufs)
187
+
self.get_mut().as_mut().poll_write_vectored(cx, bufs)
188
188
}
189
189
}
190
190
···
195
195
type Err = T::Err;
196
196
197
197
fn poll_write(
198
-
self: Pin<&mut Self>,
198
+
mut self: Pin<&mut Self>,
199
199
cx: &mut Context<'_>,
200
200
buf: &[u8],
201
201
) -> Poll<Result<usize, Self::Err>> {
202
-
self.poll_write(cx, buf)
202
+
Pin::new(&mut **self).poll_write(cx, buf)
203
203
}
204
204
205
-
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Err>> {
206
-
self.poll_flush(cx)
205
+
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Err>> {
206
+
Pin::new(&mut **self).poll_flush(cx)
207
207
}
208
208
209
-
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Err>> {
210
-
self.poll_close(cx)
209
+
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Err>> {
210
+
Pin::new(&mut **self).poll_close(cx)
211
211
}
212
212
213
213
fn poll_write_vectored(
214
-
self: Pin<&mut Self>,
214
+
mut self: Pin<&mut Self>,
215
215
cx: &mut Context<'_>,
216
216
bufs: &[&[u8]],
217
217
) -> Poll<Result<usize, Self::Err>> {
218
-
self.poll_write_vectored(cx, bufs)
218
+
Pin::new(&mut **self).poll_write_vectored(cx, bufs)
219
219
}
220
220
}
History
3 rounds
0 comments
jonaskruckenberg.de
submitted
#2
1 commit
expand
collapse
feat: async IO traits
no conflicts, ready to merge
expand 0 comments
jonaskruckenberg.de
submitted
#1
1 commit
expand
collapse
feat: async IO traits
expand 0 comments
jonaskruckenberg.de
submitted
#0
1 commit
expand
collapse
feat: async IO traits