use crate::*;
use core::{slice::from_raw_parts, slice::from_raw_parts_mut};
impl<Kind: StringletKind, const SIZE: usize> StringletBase<Kind, SIZE> {
#[inline]
pub(crate) const fn var_last(&self) -> u8 {
debug_assert!(Kind::VAR, "unchecked call");
unsafe { (self as *const Self as *const u8).add(SIZE).read() }
}
#[inline]
pub(crate) const fn as_slice(&self) -> &[u8] {
let ptr = self as *const Self as *const u8;
unsafe { from_raw_parts(ptr, SIZE + size_of::<Kind::ExtraLen>()) }
}
#[inline]
pub(crate) const fn _as_slice_mut(&mut self) -> &mut [u8] {
let ptr = self as *mut Self as *mut u8;
unsafe { from_raw_parts_mut(ptr, SIZE + size_of::<Kind::ExtraLen>()) }
}
}