[−][src]Struct futures::executor::NotifyHandle
A NotifyHandle
is the core value through which notifications are routed
in the futures
crate.
All instances of Task
will contain a NotifyHandle
handle internally.
This handle itself contains a trait object pointing to an instance of the
Notify
trait, allowing notifications to get routed through it.
The NotifyHandle
type internally does not codify any particular memory
management strategy. Internally it contains an instance of *mut UnsafeNotify
, and more details about that trait can be found on its own
documentation. Consequently, though, the one constructor of this type,
NotifyHandle::new
, is unsafe
to call. It is not recommended to call
this constructor directly.
If you're working with the standard library then it's recommended to
work with the Arc
type. If you have a struct, T
, which implements the
Notify
trait, then you can construct this with
NotifyHandle::from(t: Arc<T>)
. The coercion to UnsafeNotify
will
happen automatically and safely for you.
When working externally from the standard library it's recommended to
provide a similar safe constructor for your custom type as opposed to
recommending an invocation of NotifyHandle::new
directly.
Methods
impl NotifyHandle
[src]
impl NotifyHandle
pub unsafe fn new(inner: *mut dyn UnsafeNotify) -> NotifyHandle
[src]
pub unsafe fn new(inner: *mut dyn UnsafeNotify) -> NotifyHandle
Constructs a new NotifyHandle
directly.
Note that most code will not need to call this. Implementers of the
UnsafeNotify
trait will typically provide a wrapper that calls this
but you otherwise shouldn't call it directly.
If you're working with the standard library then it's recommended to
use the NotifyHandle::from
function instead which works with the safe
Arc
type and the safe Notify
trait.
pub fn notify(&self, id: usize)
[src]
pub fn notify(&self, id: usize)
Invokes the underlying instance of Notify
with the provided id
.
Trait Implementations
impl Clone for NotifyHandle
[src]
impl Clone for NotifyHandle
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for NotifyHandle
[src]
impl Debug for NotifyHandle
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Send for NotifyHandle
[src]
impl Send for NotifyHandle
impl Sync for NotifyHandle
[src]
impl Sync for NotifyHandle
impl<T> From<Arc<T>> for NotifyHandle where
T: Notify + 'static,
[src]
impl<T> From<Arc<T>> for NotifyHandle where
T: Notify + 'static,
fn from(rc: Arc<T>) -> NotifyHandle
[src]
fn from(rc: Arc<T>) -> NotifyHandle
Performs the conversion.
impl<T: Notify> From<&'static T> for NotifyHandle
[src]
impl<T: Notify> From<&'static T> for NotifyHandle
fn from(src: &'static T) -> NotifyHandle
[src]
fn from(src: &'static T) -> NotifyHandle
Performs the conversion.
impl Drop for NotifyHandle
[src]
impl Drop for NotifyHandle
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more