Struct droom_ui::element::guard::Guard
[−]
[src]
pub struct Guard<E: Element>(_);
Guards an element by effectively destroying it on drop.
This does not provide ownership semantics (like cell types or smart pointers), just a simple dropper for the wrapped element.
The programmer must make there's no copies of the element flying around the program.
It's recommended to use this only for resource elements (those elements that cannot be attached to a dialog in any meaningful way).
It's undefined behaviour to manually destroy a element that is wrapped within a guard, unless
the elements gets unwrap
ped before Drop
gets called. Consequently it is also undefined
behaviour to have two guards guarding the same element.
Please refer to the crate level documentation of IUP-Rust (the main doc page) for details on ownership of elements.
Methods
impl<E: Element> Guard<E>
[src]
fn new(element: E) -> Guard<E>
Creates a guard for the specified element.
fn unwrap(self) -> E
Forgets this guard and unwraps out the contained element.
Trait Implementations
impl<E: Debug + Element> Debug for Guard<E>
[src]
impl<E: Element> Drop for Guard<E>
[src]
impl<E: Element> Deref for Guard<E>
[src]
Be careful on deferecing so you don't store another copy of the element somewhere.
type Target = E
The resulting type after dereferencing
fn deref(&self) -> &E
The method called to dereference a value
impl<E: Element> DerefMut for Guard<E>
[src]
Be careful on deferecing so you don't store another copy of the element somewhere.
fn deref_mut(&mut self) -> &mut E
The method called to mutably dereference a value