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§

source§

impl ThreadLooper

source

pub fn prepare() -> Self

Prepares a looper for the current thread and returns it

source

pub fn for_thread() -> Option<Self>

Returns the looper associated with the current thread, if any.

source

pub fn poll_once(&self) -> Result<Poll<'_>, LooperError>

Polls the looper, blocking on processing an event.

source

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 Duration::ZERO to make this non-blocking.

It panics if the timeout is larger than expressible as an i32 of milliseconds (roughly 25 days).

source

pub fn poll_all(&self) -> Result<Poll<'_>, LooperError>

Repeatedly polls the looper, blocking on processing an event.

This function will never return Poll::Callback.

source

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 Duration::ZERO 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).

source

pub fn as_foreign(&self) -> &ForeignLooper

Returns a reference to the ForeignLooper that is associated with the current thread.

source

pub fn into_foreign(self) -> ForeignLooper

Trait Implementations§

source§

impl Debug for ThreadLooper

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.