Struct glib::MainContext [−][src]
pub struct MainContext(_);
Methods
impl MainContext[src]
impl MainContextpub fn new() -> MainContext[src]
pub fn new() -> MainContextpub fn acquire(&self) -> bool[src]
pub fn acquire(&self) -> boolpub fn dispatch(&self)[src]
pub fn dispatch(&self)pub fn is_owner(&self) -> bool[src]
pub fn is_owner(&self) -> boolpub fn iteration(&self, may_block: bool) -> bool[src]
pub fn iteration(&self, may_block: bool) -> boolpub fn pending(&self) -> bool[src]
pub fn pending(&self) -> boolpub fn pop_thread_default(&self)[src]
pub fn pop_thread_default(&self)pub fn push_thread_default(&self)[src]
pub fn push_thread_default(&self)pub fn release(&self)[src]
pub fn release(&self)pub fn wakeup(&self)[src]
pub fn wakeup(&self)pub fn default() -> MainContext[src]
pub fn default() -> MainContextpub fn get_thread_default() -> Option<MainContext>[src]
pub fn get_thread_default() -> Option<MainContext>pub fn ref_thread_default() -> MainContext[src]
pub fn ref_thread_default() -> MainContextimpl MainContext[src]
impl MainContextpub fn prepare(&self) -> (bool, i32)[src]
pub fn prepare(&self) -> (bool, i32)pub fn find_source_by_id(&self, source_id: &SourceId) -> Option<Source>[src]
pub fn find_source_by_id(&self, source_id: &SourceId) -> Option<Source>pub fn invoke<F>(&self, func: F) where
F: FnOnce() + Send + 'static, [src]
pub fn invoke<F>(&self, func: F) where
F: FnOnce() + Send + 'static, pub fn invoke_with_priority<F>(&self, priority: Priority, func: F) where
F: FnOnce() + Send + 'static, [src]
pub fn invoke_with_priority<F>(&self, priority: Priority, func: F) where
F: FnOnce() + Send + 'static, pub fn with_thread_default<R, F: Sized>(&self, func: F) -> R where
F: FnOnce() -> R, [src]
pub fn with_thread_default<R, F: Sized>(&self, func: F) -> R where
F: FnOnce() -> R, Calls closure with context configured as the thread default one.
Thread default context is changed in panic-safe manner by calling
push_thread_default before calling closure
and pop_thread_default afterwards regardless
of whether closure panicked or not.
impl MainContext[src]
impl MainContextpub fn spawn<F: Future<Item = (), Error = Never> + Send + 'static>(&self, f: F)[src]
pub fn spawn<F: Future<Item = (), Error = Never> + Send + 'static>(&self, f: F)Spawn a new infallible Future on the main context.
This can be called from any thread and will execute the future from the thread
where main context is running, e.g. via a MainLoop.
pub fn spawn_local<F: Future<Item = (), Error = Never> + 'static>(&self, f: F)[src]
pub fn spawn_local<F: Future<Item = (), Error = Never> + 'static>(&self, f: F)Spawn a new infallible Future on the main context.
The given Future does not have to be Send.
This can be called only from the thread where the main context is running, e.g.
from any other Future that is executed on this main context, or after calling
push_thread_default or acquire on the main context.
pub fn spawn_with_priority<F: Future<Item = (), Error = Never> + Send + 'static>(
&self,
priority: Priority,
f: F
)[src]
pub fn spawn_with_priority<F: Future<Item = (), Error = Never> + Send + 'static>(
&self,
priority: Priority,
f: F
)Spawn a new infallible Future on the main context, with a non-default priority.
This can be called from any thread and will execute the future from the thread
where main context is running, e.g. via a MainLoop.
pub fn spawn_local_with_priority<F: Future<Item = (), Error = Never> + 'static>(
&self,
priority: Priority,
f: F
)[src]
pub fn spawn_local_with_priority<F: Future<Item = (), Error = Never> + 'static>(
&self,
priority: Priority,
f: F
)Spawn a new infallible Future on the main context, with a non-default priority.
The given Future does not have to be Send.
This can be called only from the thread where the main context is running, e.g.
from any other Future that is executed on this main context, or after calling
push_thread_default or acquire on the main context.
pub fn block_on<F: Future>(&self, f: F) -> Result<F::Item, F::Error>[src]
pub fn block_on<F: Future>(&self, f: F) -> Result<F::Item, F::Error>Runs a new, infallible Future on the main context and block until it finished, returning
the result of the Future.
The given Future does not have to be Send or 'static.
This must only be called if no MainLoop or anything else is running on this specific main
context.
Trait Implementations
impl Debug for MainContext[src]
impl Debug for MainContextfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl PartialEq for MainContext[src]
impl PartialEq for MainContextfn eq(&self, other: &MainContext) -> bool[src]
fn eq(&self, other: &MainContext) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &MainContext) -> bool[src]
fn ne(&self, other: &MainContext) -> boolThis method tests for !=.
impl Eq for MainContext[src]
impl Eq for MainContextimpl PartialOrd for MainContext[src]
impl PartialOrd for MainContextfn partial_cmp(&self, other: &MainContext) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &MainContext) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &MainContext) -> bool[src]
fn lt(&self, other: &MainContext) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &MainContext) -> bool[src]
fn le(&self, other: &MainContext) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &MainContext) -> bool[src]
fn gt(&self, other: &MainContext) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &MainContext) -> bool[src]
fn ge(&self, other: &MainContext) -> boolThis method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl Ord for MainContext[src]
impl Ord for MainContextfn cmp(&self, other: &MainContext) -> Ordering[src]
fn cmp(&self, other: &MainContext) -> OrderingThis method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self1.21.0[src]
fn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more
impl Hash for MainContext[src]
impl Hash for MainContextfn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash<__H: Hasher>(&self, state: &mut __H)Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl Clone for MainContext[src]
impl Clone for MainContextfn clone(&self) -> MainContext[src]
fn clone(&self) -> MainContextReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl StaticType for MainContext[src]
impl StaticType for MainContextfn static_type() -> Type[src]
fn static_type() -> TypeReturns the type identifier of Self.
impl Default for MainContext[src]
impl Default for MainContextimpl Send for MainContext[src]
impl Send for MainContextimpl Sync for MainContext[src]
impl Sync for MainContextimpl Executor for MainContext[src]
impl Executor for MainContext