[−][src]Struct update_channel::Receiver
The receiving half of an update channel
This struct holds an internal buffer in which data is held. The buffer can then be updated with recv_update, take_update usw.
Implementations
impl<T> Receiver<T>
[src]
pub fn take_update(&mut self) -> Result<Option<T>, ReceiveError>
[src]
Takes the new updated value and make it unavailable for all other receivers. Returns the previous value inside the buffer if the value has not been taken by another receiver, otherwise Returns Ok(None)
pub unsafe fn take_update_unsafe(&self) -> Result<Option<T>, ReceiveError>
[src]
Same as Receiver::take_update
but without borrowing mutably.
This might open new possiblities, but it might result in undefined behavior if there are immutable borrows
created with Receiver::borrow
pub fn borrow(&self) -> &T
[src]
Get the value saved in the internal buffer without updating as borrow
pub fn borrow_mut(&mut self) -> &mut T
[src]
Get a mutable reference to the value in the buffer
pub fn into_inner(self) -> T
[src]
Unwrap the value contained in the buffer of this receiver
pub fn borrow_locked<'a>(
&'a self
) -> Result<RwLockReadGuard<'a, Option<T>>, ReceiveError>
[src]
&'a self
) -> Result<RwLockReadGuard<'a, Option<T>>, ReceiveError>
Get the latest value (not the value in the buffer) and return it while holding a read lock to it. It is not recommended to hold on to this lock for long.
pub fn has_updater(&self) -> bool
[src]
Checks if at least one updater exists
impl<T> Receiver<T> where
T: Clone,
[src]
T: Clone,
pub fn recv_update(&mut self) -> Result<Option<T>, ReceiveError>
[src]
Clone the latest updated value into the internal buffer. Returns the previous value inside the buffer if the value has not been taken by another receiver
pub unsafe fn recv_update_unsafe(&self) -> Result<Option<T>, ReceiveError>
[src]
Same as Receiver::recv_update
but without borrowing mutably.
This might open new possiblities, but it might result in undefined behavior if there are immutable borrows
created with Receiver::borrow
pub fn get_cloned(&self) -> Result<Option<T>, ReceiveError>
[src]
Get the latest value (not the value in the buffer) cloned
impl<T> Receiver<T> where
T: Clone + PartialEq,
[src]
T: Clone + PartialEq,
pub fn recv_update_checked(&mut self) -> Result<Option<T>, ReceiveError>
[src]
Updates the internal buffer by cloning the updated value if it is different from the current held value
pub unsafe fn recv_update_checked_unsafe(
&self
) -> Result<Option<T>, ReceiveError>
[src]
&self
) -> Result<Option<T>, ReceiveError>
Same as Receiver::recv_update_checked
but without borrowing mutably.
This might open new possiblities, but it might result in undefined behavior if there are immutable borrows
created with Receiver::borrow
pub fn take_update_checked(&mut self) -> Result<Option<T>, ReceiveError>
[src]
Updates the internal buffer by taking the updated value if it is different from the current held value
pub unsafe fn take_update_checked_unsafe(
&self
) -> Result<Option<T>, ReceiveError>
[src]
&self
) -> Result<Option<T>, ReceiveError>
Same as Receiver::recv_update_checked
but without borrowing mutably.
This might open new possiblities, but it might result in undefined behavior if there are immutable borrows
created with Receiver::borrow
Trait Implementations
impl<T> Clone for Receiver<T> where
T: Clone,
[src]
T: Clone,
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for Receiver<T>
[src]
impl<T> Send for Receiver<T> where
T: Clone,
[src]
T: Clone,
Auto Trait Implementations
impl<T> !RefUnwindSafe for Receiver<T>
[src]
impl<T> !Sync for Receiver<T>
[src]
impl<T> Unpin for Receiver<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Receiver<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,