pub struct TopicRegistry { /* private fields */ }Expand description
Registry of all topics discovered via #[photon::topic].
Implementations§
Source§impl TopicRegistry
impl TopicRegistry
pub fn new() -> Self
pub fn auto_discover() -> Self
pub fn register(&mut self, item: &'static TopicDescriptor)
Source§impl TopicRegistry
impl TopicRegistry
Sourcepub fn get_or_err(&self, topic_name: &str) -> Result<&'static TopicDescriptor>
pub fn get_or_err(&self, topic_name: &str) -> Result<&'static TopicDescriptor>
Look up a topic by name, returning an error if not found.
§Errors
Returns an error if the operation fails.
Sourcepub fn sorted_topic_names(&self) -> Vec<&str>
pub fn sorted_topic_names(&self) -> Vec<&str>
Topic names in sorted order for deterministic registration across platforms.
Methods from Deref<Target = Registry<TopicDescriptor>>§
Sourcepub fn register(&mut self, item: &'static T)
pub fn register(&mut self, item: &'static T)
Insert a descriptor. If a descriptor with the same key already exists, it is replaced (last-write-wins).
Sourcepub fn get(&self, key: &str) -> Option<&'static T>
pub fn get(&self, key: &str) -> Option<&'static T>
Look up an item by registry key.
Sourcepub fn iter(&self) -> impl Iterator<Item = &'static T>
pub fn iter(&self) -> impl Iterator<Item = &'static T>
Iterates over all registered descriptors in arbitrary order.
Trait Implementations§
Source§impl Clone for TopicRegistry
impl Clone for TopicRegistry
Source§impl Debug for TopicRegistry
impl Debug for TopicRegistry
Source§impl Default for TopicRegistry
impl Default for TopicRegistry
Source§impl Deref for TopicRegistry
impl Deref for TopicRegistry
Auto Trait Implementations§
impl Freeze for TopicRegistry
impl RefUnwindSafe for TopicRegistry
impl Send for TopicRegistry
impl Sync for TopicRegistry
impl Unpin for TopicRegistry
impl UnsafeUnpin for TopicRegistry
impl UnwindSafe for TopicRegistry
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