Make code compile

pull/625/head
Gary Guo 5 years ago
parent 499a44ab3b
commit 732ef10f98

@ -93,12 +93,12 @@ impl<T: ?Sized> Mutex<T> {
/// # })
/// ```
pub async fn lock(&self) -> MutexGuard<'_, T> {
pub struct LockFuture<'a, T> {
pub struct LockFuture<'a, T: ?Sized> {
mutex: &'a Mutex<T>,
opt_key: Option<usize>,
}
impl<'a, T> Future for LockFuture<'a, T> {
impl<'a, T: ?Sized> Future for LockFuture<'a, T> {
type Output = MutexGuard<'a, T>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
@ -125,7 +125,7 @@ impl<T: ?Sized> Mutex<T> {
}
}
impl<T> Drop for LockFuture<'_, T> {
impl<T: ?Sized> Drop for LockFuture<'_, T> {
fn drop(&mut self) {
// If the current task is still in the set, that means it is being cancelled now.
if let Some(key) = self.opt_key {

@ -101,12 +101,12 @@ impl<T: ?Sized> RwLock<T> {
/// # })
/// ```
pub async fn read(&self) -> RwLockReadGuard<'_, T> {
pub struct ReadFuture<'a, T> {
pub struct ReadFuture<'a, T: ?Sized> {
lock: &'a RwLock<T>,
opt_key: Option<usize>,
}
impl<'a, T> Future for ReadFuture<'a, T> {
impl<'a, T: ?Sized> Future for ReadFuture<'a, T> {
type Output = RwLockReadGuard<'a, T>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
@ -133,7 +133,7 @@ impl<T: ?Sized> RwLock<T> {
}
}
impl<T> Drop for ReadFuture<'_, T> {
impl<T: ?Sized> Drop for ReadFuture<'_, T> {
fn drop(&mut self) {
// If the current task is still in the set, that means it is being cancelled now.
if let Some(key) = self.opt_key {
@ -226,12 +226,12 @@ impl<T: ?Sized> RwLock<T> {
/// # })
/// ```
pub async fn write(&self) -> RwLockWriteGuard<'_, T> {
pub struct WriteFuture<'a, T> {
pub struct WriteFuture<'a, T: ?Sized> {
lock: &'a RwLock<T>,
opt_key: Option<usize>,
}
impl<'a, T> Future for WriteFuture<'a, T> {
impl<'a, T: ?Sized> Future for WriteFuture<'a, T> {
type Output = RwLockWriteGuard<'a, T>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
@ -258,7 +258,7 @@ impl<T: ?Sized> RwLock<T> {
}
}
impl<T> Drop for WriteFuture<'_, T> {
impl<T: ?Sized> Drop for WriteFuture<'_, T> {
fn drop(&mut self) {
// If the current task is still in the set, that means it is being cancelled now.
if let Some(key) = self.opt_key {

Loading…
Cancel
Save