Struct dui::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]

[src]

Creates a guard for the specified element.

[src]

Forgets this guard and unwraps out the contained element.

Trait Implementations

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

[src]

Formats the value using the given formatter. Read more

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

[src]

Executes the destructor for this type. 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.

[src]

Dereferences the value.

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

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

[src]

Mutably dereferences the value.

Auto Trait Implementations

impl<E> Send for Guard<E> where
    E: Send

impl<E> Sync for Guard<E> where
    E: Sync