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 unwrapped 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]

Creates a guard for the specified element.

Forgets this guard and unwraps out the contained element.

Trait Implementations

impl<E: Debug + Element> Debug for Guard<E>
[src]

Formats the value using the given formatter.

impl<E: Element> Drop for Guard<E>
[src]

A method called when the value goes out of scope. Read more

impl<E: Element> Deref for Guard<E>
[src]

Be careful on deferecing so you don't store another copy of the element somewhere.

The resulting type after dereferencing

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.

The method called to mutably dereference a value