Struct wlc_with_elogind::WeakView
[−]
[src]
pub struct WeakView(_, _);
Weak reference to a view
Can be optained by view.weak_reference()
Methods
impl WeakView
[src]
unsafe fn upgrade(&self) -> Option<&View>
[src]
Upgrade your weak reference to an actual View
Safety
This function is unsafe, because it creates a lifetime bound to the
WeakView, which may live forever..
But no view lives forever and might be destroyed by its process at any
time
A disconnection is signaled by Callback::view_destroyed
and the View
is deallocated shortly after.
Because of this using this function one may create an invalid View
reference.
Also using this function it is possible to optain multiple mutable
references, which is also unsafe
See WeakView::run
for a safe variant
fn run<F, R>(&self, runner: F) -> Option<R> where
F: FnOnce(&View) -> R,
[src]
F: FnOnce(&View) -> R,
Run a function on the referenced View, if it still exists
Returns the result of the function, if successful
Safety
By enforcing a rather harsh limit on the lifetime of the view to a short lived scope of an anonymous function, this function makes sure the view does not live longer then it exists.
Trait Implementations
impl Clone for WeakView
[src]
fn clone(&self) -> WeakView
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for WeakView
[src]
impl !Send for WeakView
[src]
impl !Sync for WeakView
[src]
impl PartialEq<View> for WeakView
[src]
fn eq(&self, other: &View) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq for WeakView
[src]
fn eq(&self, other: &WeakView) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.