[−][src]Struct mrwei::Promise
A struct that accepts a value and notify the corresponding future.
Implementations
impl<T> Promise<T>
[src]
pub fn set_value(self, value: T) -> Option<T>
[src]
Offers a value to the promise.
It will wake up any awaited futures.
pub fn into_raw(s: Promise<T>) -> NonNull<MaybeUninit<T>>
[src]
Get a mutable pointer to the underlying value.
Remember to use from_raw
to reclaim the memory and make notification work
correctly.
pub unsafe fn from_raw(ptr: NonNull<MaybeUninit<T>>) -> Promise<T>
[src]
Reconstruct the promise from given pointer.
The pointer must be the returned value of into_raw
.
Safety
If the pointer is not generated by into_raw
, it can lead to undefined behavior.
pub unsafe fn assume_value_set(self)
[src]
Assumes the value is set.
It will wake up any awaited futures.
Safety
If no value has been set, calling the function lead to undefined behavior.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Promise<T>
[src]
impl<T> !Sync for Promise<T>
[src]
impl<T> Unpin for Promise<T>
[src]
impl<T> !UnwindSafe for Promise<T>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,