pub struct Topic<T: 'static> { /* private fields */ }Expand description
Type-safe event topic.
T is the payload type associated with the topic. Two topics are equal only
when both the topic name and payload type match.
Implementations§
Source§impl<T: 'static> Topic<T>
impl<T: 'static> Topic<T>
Sourcepub fn try_new(name: impl Into<String>) -> EventBusResult<Self>
pub fn try_new(name: impl Into<String>) -> EventBusResult<Self>
Creates a topic after validating its name.
§Parameters
name: Non-blank topic name.
§Returns
A type-safe topic bound to T.
§Errors
Returns EventBusError::InvalidArgument when name is blank.
Sourcepub fn payload_type_id(&self) -> TypeId
pub fn payload_type_id(&self) -> TypeId
Sourcepub fn payload_type_name(&self) -> &'static str
pub fn payload_type_name(&self) -> &'static str
Trait Implementations§
impl<T: 'static> Eq for Topic<T>
Auto Trait Implementations§
impl<T> Freeze for Topic<T>
impl<T> RefUnwindSafe for Topic<T>
impl<T> Send for Topic<T>
impl<T> Sync for Topic<T>
impl<T> Unpin for Topic<T>
impl<T> UnsafeUnpin for Topic<T>
impl<T> UnwindSafe for Topic<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> IntoValueDefault<T> for T
impl<T> IntoValueDefault<T> for T
Source§fn into_value_default(self) -> T
fn into_value_default(self) -> T
Converts this argument into the default value.