pub struct ForeignLooper { /* private fields */ }Expand description
An ALooper, not necessarily allociated with the current thread.
Implementations§
Source§impl 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.
By calling this function, you guarantee that the pointer is a valid, non-null pointer to an
NDK ALooper.
Sourcepub unsafe fn add_fd(
&self,
fd: RawFd,
ident: i32,
event: i32,
data: *mut c_void,
) -> Result<(), LooperError>
pub unsafe fn add_fd( &self, fd: RawFd, ident: i32, event: i32, data: *mut c_void, ) -> Result<(), LooperError>
Adds a file descriptor to be polled, without a callback.
See also the NDK docs.
Sourcepub unsafe fn add_fd_with_callback(
&self,
fd: RawFd,
ident: i32,
event: i32,
callback: Box<dyn FnMut(RawFd) -> bool>,
) -> Result<(), LooperError>
pub unsafe fn add_fd_with_callback( &self, fd: RawFd, ident: i32, event: i32, callback: Box<dyn FnMut(RawFd) -> bool>, ) -> 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§
Source§impl Clone for ForeignLooper
impl Clone for ForeignLooper
Source§impl Debug for ForeignLooper
impl Debug for ForeignLooper
Source§impl Drop for ForeignLooper
impl Drop for ForeignLooper
impl Send for ForeignLooper
impl Sync for ForeignLooper
Auto Trait Implementations§
impl Freeze for ForeignLooper
impl RefUnwindSafe for ForeignLooper
impl Unpin for ForeignLooper
impl UnwindSafe for ForeignLooper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more