pub struct Channel {
pub type_reg: TypeReg,
/* private fields */
}Expand description
A type-erased broadcast channel for a single type, with optional support for out-of-band (de)serialization to/from another internal broadcast channel.
Fields§
§type_reg: TypeRegThe type registration used to create this channel.
Implementations§
Source§impl Channel
impl Channel
pub fn from_type_reg(type_reg: TypeReg) -> Self
Sourcepub fn send_event<T: BusType>(&self, event: BusEvent<T>)
pub fn send_event<T: BusType>(&self, event: BusEvent<T>)
Panics if type T is not the same as the underlying erased type.
pub fn send_serde_event(&self, event: BusEvent<SerdePayload>)
pub fn update_latest<T: Default + BusType>(&self, f: impl FnOnce(T) -> T)
pub fn subscribe<T: BusType>( &self, prefix_latest: bool, ) -> Receiver<BusEvent<T>>
pub fn subscribe_serde(&self) -> Receiver<BusEvent<SerdePayload>>
pub fn get_latest<T: BusType>(&self) -> Option<BusEvent<T>>
Auto Trait Implementations§
impl Freeze for Channel
impl !RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl !UnwindSafe for Channel
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