#![doc = include_str!("../README.md")]
#![no_std]
use core::{cell::UnsafeCell, marker::PhantomPinned};
#[doc = include_str!("../README.md")]
#[repr(transparent)]
pub struct UnsafeAliasCell<T: ?Sized> {
_pin: PhantomPinned,
inner: UnsafeCell<T>,
}
impl<T> UnsafeAliasCell<T> {
#[inline]
pub const fn new(value: T) -> Self {
Self {
inner: UnsafeCell::new(value),
_pin: PhantomPinned,
}
}
}
impl<T: ?Sized> UnsafeAliasCell<T> {
#[inline]
pub const fn get(&self) -> *mut T {
self.inner.get()
}
#[inline]
pub const fn raw_get(this: *const Self) -> *mut T {
UnsafeCell::raw_get(this as *const UnsafeCell<T>)
}
}