feat(sharedptr): add size to slice type information
This commit is contained in:
@@ -7,7 +7,7 @@ use std::{
|
||||
use crate::allocator::ALLOCATOR;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SharedPtr<'a, const N: usize>(&'a mut [u8]);
|
||||
pub struct SharedPtr<'a, const N: usize>(&'a mut [u8; N]);
|
||||
|
||||
impl<const N: usize> SharedPtr<'_, N> {
|
||||
pub fn new() -> Option<Self> {
|
||||
@@ -18,7 +18,7 @@ impl<const N: usize> SharedPtr<'_, N> {
|
||||
slice::from_raw_parts_mut(buf, N)
|
||||
};
|
||||
|
||||
Some(SharedPtr(buf))
|
||||
Some(SharedPtr(buf.try_into().expect("Should never fail")))
|
||||
}
|
||||
|
||||
pub fn get_offset(&self) -> usize {
|
||||
@@ -31,7 +31,7 @@ impl<const N: usize> SharedPtr<'_, N> {
|
||||
}
|
||||
|
||||
impl<'a, const N: usize> Deref for SharedPtr<'a, N> {
|
||||
type Target = &'a mut [u8];
|
||||
type Target = &'a mut [u8; N];
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
|
||||
Reference in New Issue
Block a user