Struct ndk::looper::ThreadLooper
source · [−]pub struct ThreadLooper { /* private fields */ }
Expand description
A thread-local native ALooper *
. This promises that there is a looper associated with the
current thread.
Implementations
sourceimpl ThreadLooper
impl ThreadLooper
sourcepub fn for_thread() -> Option<Self>
pub fn for_thread() -> Option<Self>
Returns the looper associated with the current thread, if any.
sourcepub fn poll_once(&self) -> Result<Poll, LooperError>
pub fn poll_once(&self) -> Result<Poll, LooperError>
Polls the looper, blocking on processing an event.
sourcepub fn poll_once_timeout(&self, timeout: Duration) -> Result<Poll, LooperError>
pub fn poll_once_timeout(&self, timeout: Duration) -> Result<Poll, LooperError>
Polls the looper, blocking on processing an event, but with a timeout. Give a timeout of 0 to make this non-blocking.
It panics if the timeout is larger than expressible as an i32
of milliseconds (roughly 25
days).
sourcepub fn poll_all(&self) -> Result<Poll, LooperError>
pub fn poll_all(&self) -> Result<Poll, LooperError>
Repeatedly polls the looper, blocking on processing an event.
This function will never return Poll::Callback
.
sourcepub fn poll_all_timeout(&self, timeout: Duration) -> Result<Poll, LooperError>
pub fn poll_all_timeout(&self, timeout: Duration) -> Result<Poll, LooperError>
Repeatedly polls the looper, blocking on processing an event, but with a timeout. Give a timeout of 0 to make this non-blocking.
This function will never return Poll::Callback
.
It panics if the timeout is larger than expressible as an i32
of milliseconds (roughly 25
days).
sourcepub fn as_foreign(&self) -> &ForeignLooper
pub fn as_foreign(&self) -> &ForeignLooper
Returns a reference to the ForeignLooper
that is associated with the current thread.
pub fn into_foreign(self) -> ForeignLooper
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ThreadLooper
impl !Send for ThreadLooper
impl !Sync for ThreadLooper
impl Unpin for ThreadLooper
impl UnwindSafe for ThreadLooper
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more