mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-09-28 04:50:34 +00:00
AsRef, AsMut for pool
This commit is contained in:
parent
e0b3b3a179
commit
618eebfcb9
@ -439,6 +439,24 @@ unsafe impl<T, S> Sync for Box<T, S> where T: Sync {}
|
||||
|
||||
unsafe impl<T> stable_deref_trait::StableDeref for Box<T> {}
|
||||
|
||||
impl<A, T> AsRef<[T]> for Box<A>
|
||||
where
|
||||
A: AsRef<[T]>,
|
||||
{
|
||||
fn as_ref(&self) -> &[T] {
|
||||
self.deref().as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl<A, T> AsMut<[T]> for Box<A>
|
||||
where
|
||||
A: AsMut<[T]>,
|
||||
{
|
||||
fn as_mut(&mut self) -> &mut [T] {
|
||||
self.deref_mut().as_mut()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Deref for Box<T> {
|
||||
type Target = T;
|
||||
|
||||
|
@ -244,6 +244,26 @@ where
|
||||
{
|
||||
}
|
||||
|
||||
impl<P, T> AsRef<[T]> for Box<P>
|
||||
where
|
||||
P: Pool,
|
||||
P::Data: AsRef<[T]>,
|
||||
{
|
||||
fn as_ref(&self) -> &[T] {
|
||||
self.deref().as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl<P, T> AsMut<[T]> for Box<P>
|
||||
where
|
||||
P: Pool,
|
||||
P::Data: AsMut<[T]>,
|
||||
{
|
||||
fn as_mut(&mut self) -> &mut [T] {
|
||||
self.deref_mut().as_mut()
|
||||
}
|
||||
}
|
||||
|
||||
impl<P> PartialEq for Box<P>
|
||||
where
|
||||
P: Pool,
|
||||
|
Loading…
x
Reference in New Issue
Block a user