Small fixes

This commit is contained in:
Stjepan Glavina 2020-02-11 18:01:12 +01:00
parent 8a5f43e7c3
commit e79aa38c9b
1 changed files with 8 additions and 3 deletions

View File

@ -375,7 +375,7 @@ pub fn run<T>(future: impl Future<Output = T>) -> T {
}
/// A spawned future.
#[must_use = "tasks are dropped when cancelled, use `.forget()` to run in the background"]
#[must_use = "tasks are canceled when dropped, use `.forget()` to run in the background"]
pub struct Task<T>(Option<async_task::JoinHandle<T, ()>>);
impl<T: Send + 'static> Task<T> {
@ -708,15 +708,20 @@ impl<T: std::os::windows::io::AsRawSocket> Async<T> {
impl<T> Async<T> {
/// Gets a reference to the I/O source.
pub fn source(&self) -> &T {
pub fn get_ref(&self) -> &T {
&self.source
}
/// Gets a mutable reference to the I/O source.
pub fn source_mut(&mut self) -> &mut T {
pub fn get_mut(&mut self) -> &mut T {
&mut self.source
}
/// Extracts the inner I/O source.
pub fn into_inner(&mut self) -> &mut T {
todo!()
}
/// Converts a non-blocking read into an async operation.
pub async fn read_with<R>(&self, f: impl FnMut(&T) -> io::Result<R>) -> io::Result<R> {
let mut f = f;