Struct ndk::looper::ForeignLooper
source · [−]pub struct ForeignLooper { /* private fields */ }
Expand description
A native ALooper *
, not necessarily allocated with the current thread.
Implementations
sourceimpl ForeignLooper
impl ForeignLooper
sourcepub fn for_thread() -> Option<Self>
pub fn for_thread() -> Option<Self>
Returns the looper associated with the current thread, if any.
sourcepub unsafe fn from_ptr(ptr: NonNull<ALooper>) -> Self
pub unsafe fn from_ptr(ptr: NonNull<ALooper>) -> Self
Construct a ForeignLooper
object from the given pointer.
Safety
By calling this function, you guarantee that the pointer is a valid, non-null pointer to an
NDK ffi::ALooper
.
sourcepub fn wake(&self)
pub fn wake(&self)
Wakes the looper. An event of Poll::Wake
will be sent.
sourcepub fn add_fd(
&self,
fd: RawFd,
ident: i32,
events: FdEvent,
data: *mut c_void
) -> Result<(), LooperError>
pub fn add_fd(
&self,
fd: RawFd,
ident: i32,
events: FdEvent,
data: *mut c_void
) -> Result<(), LooperError>
Adds a file descriptor to be polled, without a callback.
See also the NDK docs.
sourcepub fn add_fd_with_callback<F: FnMut(RawFd) -> bool>(
&self,
fd: RawFd,
events: FdEvent,
callback: F
) -> Result<(), LooperError>
pub fn add_fd_with_callback<F: FnMut(RawFd) -> bool>(
&self,
fd: RawFd,
events: FdEvent,
callback: F
) -> Result<(), LooperError>
Adds a file descriptor to be polled, with a callback.
The callback takes as an argument the file descriptor, and should return true to continue receiving callbacks, or false to have the callback unregistered.
See also the NDK docs.
Trait Implementations
sourceimpl Clone for ForeignLooper
impl Clone for ForeignLooper
sourceimpl Debug for ForeignLooper
impl Debug for ForeignLooper
sourceimpl Drop for ForeignLooper
impl Drop for ForeignLooper
impl Send for ForeignLooper
impl Sync for ForeignLooper
Auto Trait Implementations
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