[−][src]Struct glib::MainContext
Implementations
impl MainContext
[src]
pub fn new() -> MainContext
[src]
pub fn acquire(&self) -> bool
[src]
pub fn dispatch(&self)
[src]
pub fn is_owner(&self) -> bool
[src]
pub fn iteration(&self, may_block: bool) -> bool
[src]
pub fn pending(&self) -> bool
[src]
pub fn pop_thread_default(&self)
[src]
pub fn push_thread_default(&self)
[src]
pub fn release(&self)
[src]
pub fn wakeup(&self)
[src]
pub fn default() -> MainContext
[src]
pub fn get_thread_default() -> Option<MainContext>
[src]
pub fn ref_thread_default() -> MainContext
[src]
impl MainContext
[src]
pub fn prepare(&self) -> (bool, i32)
[src]
pub fn find_source_by_id(&self, source_id: &SourceId) -> Option<Source>
[src]
pub fn invoke<F>(&self, func: F) where
F: FnOnce() + Send + 'static,
[src]
F: FnOnce() + Send + 'static,
Invokes func
on the main context.
pub fn invoke_with_priority<F>(&self, priority: Priority, func: F) where
F: FnOnce() + Send + 'static,
[src]
F: FnOnce() + Send + 'static,
Invokes func
on the main context with the given priority.
pub fn invoke_local<F>(&self, func: F) where
F: FnOnce() + 'static,
[src]
F: FnOnce() + 'static,
Invokes func
on the main context.
Different to invoke()
, this does not require func
to be
Send
but can only be called from the thread that owns the main context.
This function panics if called from a different thread than the one that owns the main context.
pub fn invoke_local_with_priority<F>(&self, priority: Priority, func: F) where
F: FnOnce() + 'static,
[src]
F: FnOnce() + 'static,
Invokes func
on the main context with the given priority.
Different to invoke_with_priority()
, this does not require func
to be
Send
but can only be called from the thread that owns the main context.
This function panics if called from a different thread than the one that owns the main context.
pub fn with_thread_default<R, F: Sized>(&self, func: F) -> R where
F: FnOnce() -> R,
[src]
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]
pub fn channel<T>(priority: Priority) -> (Sender<T>, Receiver<T>)
[src]
Creates a channel for a main context.
The Receiver
has to be attached to a main context at a later time, together with a
closure that will be called for every item sent to a Sender
.
The Sender
can be cloned and both the Sender
and Receiver
can be sent to different
threads as long as the item type implements the Send
trait.
When the last Sender
is dropped the channel is removed from the main context. If the
Receiver
is dropped and not attached to a main context all sending to the Sender
will fail.
The returned Sender
behaves the same as std::sync::mpsc::Sender
.
pub fn sync_channel<T>(
priority: Priority,
bound: usize
) -> (SyncSender<T>, Receiver<T>)
[src]
priority: Priority,
bound: usize
) -> (SyncSender<T>, Receiver<T>)
Creates a synchronous channel for a main context with a given bound on the capacity of the channel.
The Receiver
has to be attached to a main context at a later time, together with a
closure that will be called for every item sent to a SyncSender
.
The SyncSender
can be cloned and both the SyncSender
and Receiver
can be sent to different
threads as long as the item type implements the Send
trait.
When the last SyncSender
is dropped the channel is removed from the main context. If the
Receiver
is dropped and not attached to a main context all sending to the SyncSender
will fail.
The returned SyncSender
behaves the same as std::sync::mpsc::SyncSender
.
impl MainContext
[src]
pub fn spawn<F: Future<Output = ()> + Send + 'static>(&self, f: F)
[src]
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<Output = ()> + 'static>(&self, f: F)
[src]
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<Output = ()> + Send + 'static>(
&self,
priority: Priority,
f: F
)
[src]
&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<Output = ()> + 'static>(
&self,
priority: Priority,
f: F
)
[src]
&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) -> F::Output
[src]
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 Clone for MainContext
[src]
fn clone(&self) -> MainContext
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for MainContext
[src]
impl Default for MainContext
[src]
impl Eq for MainContext
[src]
impl Hash for MainContext
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl LocalSpawn for MainContext
[src]
fn spawn_local_obj(
&self,
f: LocalFutureObj<'static, ()>
) -> Result<(), SpawnError>
[src]
&self,
f: LocalFutureObj<'static, ()>
) -> Result<(), SpawnError>
fn status_local(&self) -> Result<(), SpawnError>
[src]
impl Ord for MainContext
[src]
fn cmp(&self, other: &MainContext) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<MainContext> for MainContext
[src]
fn eq(&self, other: &MainContext) -> bool
[src]
fn ne(&self, other: &MainContext) -> bool
[src]
impl PartialOrd<MainContext> for MainContext
[src]
fn partial_cmp(&self, other: &MainContext) -> Option<Ordering>
[src]
fn lt(&self, other: &MainContext) -> bool
[src]
fn le(&self, other: &MainContext) -> bool
[src]
fn gt(&self, other: &MainContext) -> bool
[src]
fn ge(&self, other: &MainContext) -> bool
[src]
impl Send for MainContext
[src]
impl Spawn for MainContext
[src]
fn spawn_obj(&self, f: FutureObj<'static, ()>) -> Result<(), SpawnError>
[src]
fn status(&self) -> Result<(), SpawnError>
[src]
impl StaticType for MainContext
[src]
fn static_type() -> Type
[src]
impl StructuralEq for MainContext
[src]
impl StructuralPartialEq for MainContext
[src]
impl Sync for MainContext
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
&'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
[src]
&'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
fn to_glib_container_from_slice(
&'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
[src]
&'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
fn to_glib_full_from_slice(&[T]) -> *const GList
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
&'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
[src]
&'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
fn to_glib_container_from_slice(
&'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
[src]
&'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
fn to_glib_full_from_slice(&[T]) -> *const GPtrArray
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
&'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
[src]
&'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
fn to_glib_container_from_slice(
&'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
[src]
&'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
fn to_glib_full_from_slice(&[T]) -> *mut GArray
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
&'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
[src]
&'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
fn to_glib_container_from_slice(
&'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
[src]
&'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
fn to_glib_full_from_slice(&[T]) -> *mut GList
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
&'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
[src]
&'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
fn to_glib_container_from_slice(
&'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
[src]
&'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
fn to_glib_full_from_slice(&[T]) -> *mut GPtrArray
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToSendValue for T where
T: ToValue + SetValue + Send + ?Sized,
[src]
T: ToValue + SetValue + Send + ?Sized,
fn to_send_value(&Self) -> SendValue
[src]
impl<T> ToValue for T where
T: SetValue + ?Sized,
[src]
T: SetValue + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,