[−][src]Struct hexchat::SafeUninit
An initially uninitialized resource that is safe to use in a HexChat plugin.
It is recommended that you not use any other kind of static resource crate, because any static
resource will not get dropped when your plugin is unloaded, leading to a memory leak if the
resource contains a heap allocation. This includes thread_local!
, lazy_static
, once_cell
,
etc. It's not the crate that matters, it's the heap resource.
Any SafeUninit
s will be initialized when the init
function is called, and will be dropped
after your plugin is dropped.
A SafeUninit
must always be in a static variable. To do otherwise is undefined.
Important
Any thread which accesses a safe static, mutex or no, must be killed inside your plugin's Drop
implementation. To allow otherwise is undefined.
Methods
impl<T> SafeUninit<T>
[src]
pub fn init(&self, instance: T)
[src]
Initializes this SafeUninit
with a value. Only works the first time it's called.
Trait Implementations
impl<T> Deref for SafeUninit<T>
[src]
impl<T> Sync for SafeUninit<T> where
T: Send + Sync,
[src]
T: Send + Sync,
Auto Trait Implementations
impl<T> !RefUnwindSafe for SafeUninit<T>
impl<T> Send for SafeUninit<T> where
T: Send,
T: Send,
impl<T> Unpin for SafeUninit<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for SafeUninit<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,