Struct wlc_with_elogind::WeakOutput
[−]
[src]
pub struct WeakOutput(_, _);
Weak reference to an output
Can be optained by output.weak_reference()
Methods
impl WeakOutput
[src]
unsafe fn upgrade(&self) -> Option<&Output>
[src]
Upgrade your weak reference to an actual Output
Safety
This function is unsafe, because it creates a lifetime bound to
WeakOutput, which may live forever..
But no output lives forever and might be disconnected at any time
A disconnection is signaled by Callback::output_destroyed
and the
Output
is deallocated shortly after.
Because of this using this function one may create an invalid Output
reference.
See WeakOutput::run
for a safe variant
fn run<F, R>(&self, runner: F) -> Option<R> where
F: FnOnce(&Output) -> R,
[src]
F: FnOnce(&Output) -> R,
Run a function on the referenced Output, if it still exists
Returns the result of the function, if successful
Safety
By enforcing a rather harsh limit on the lifetime of the output to a short lived scope of an anonymous function, this function makes sure the output does not live longer then it exists.
Trait Implementations
impl Clone for WeakOutput
[src]
fn clone(&self) -> WeakOutput
[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 WeakOutput
[src]
impl !Send for WeakOutput
[src]
impl !Sync for WeakOutput
[src]
impl PartialEq<Output> for WeakOutput
[src]
fn eq(&self, other: &Output) -> 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 WeakOutput
[src]
fn eq(&self, other: &WeakOutput) -> 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 !=
.