Skip to content

Commit 5c0dc97

Browse files
WhatAmISupposedToPutHerejannau
authored andcommitted
rust: alloc: kbox: Add AsRef implementation to Box
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
1 parent 9869f1e commit 5c0dc97

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

rust/kernel/alloc/kbox.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,3 +598,13 @@ where
598598
unsafe { A::free(self.0.cast(), layout) };
599599
}
600600
}
601+
602+
impl<T, A> AsRef<T> for Box<T, A>
603+
where
604+
T: ?Sized,
605+
A: Allocator,
606+
{
607+
fn as_ref(&self) -> &T {
608+
self
609+
}
610+
}

0 commit comments

Comments
 (0)