Struct shadow_rs::host::status_listener::StatusListener
source · pub struct StatusListener { /* private fields */ }
Expand description
An object that listens for status changes.
~Deprecated: In new code consider using crate::host::descriptor::listener::StateEventSource
,
which supports Rust closures or directly takes crate::cshadow::StatusListener
.
Implementations§
source§impl StatusListener
impl StatusListener
sourcepub unsafe fn clone_from_c(host: &Host, ptr: *mut StatusListener) -> Self
pub unsafe fn clone_from_c(host: &Host, ptr: *mut StatusListener) -> Self
Create an owned reference from ptr
. Reference count is incremented on
creation, and decremented on Drop.
§Safety
ptr
must be safely dereferenceable.
sourcepub fn new(host: &Host, notify: impl Fn(&Host) + Send + Sync + 'static) -> Self
pub fn new(host: &Host, notify: impl Fn(&Host) + Send + Sync + 'static) -> Self
Create a StatusListener
with the given notification function.
sourcepub fn handle_status_change(
&self,
host: &Host,
current: FileState,
transitions: FileState,
)
pub fn handle_status_change( &self, host: &Host, current: FileState, transitions: FileState, )
Called when a transition (bit flip) occurred on at least one of its status bits. (This function should only be called by status owners, i.e., the descriptor or futex base classes.) If this listener is monitoring (via setMonitorStatus) any of the status bits that just transitioned, then this function will trigger a notification via the callback supplied to the new func.
sourcepub fn set_monitor_status(
&self,
host: &Host,
status: FileState,
filter: StatusListenerFilter,
)
pub fn set_monitor_status( &self, host: &Host, status: FileState, filter: StatusListenerFilter, )
Set the status bits that we should monitor for transitions (flips), and a filter that specifies which flips should cause the callback to be invoked.
Trait Implementations§
source§impl Debug for StatusListener
impl Debug for StatusListener
source§impl Drop for StatusListener
impl Drop for StatusListener
source§impl Ord for StatusListener
impl Ord for StatusListener
source§impl PartialEq for StatusListener
impl PartialEq for StatusListener
source§impl PartialOrd for StatusListener
impl PartialOrd for StatusListener
impl Eq for StatusListener
Auto Trait Implementations§
impl Freeze for StatusListener
impl RefUnwindSafe for StatusListener
impl Send for StatusListener
impl Sync for StatusListener
impl Unpin for StatusListener
impl UnwindSafe for StatusListener
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
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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>
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>
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