pub struct TopicInfo {
pub topic: String,
pub message_type: String,
pub publishers: Vec<String>,
pub subscribers: Vec<String>,
pub created_at: u64,
pub last_publisher_added: Option<u64>,
pub last_subscriber_added: Option<u64>,
pub description: Option<String>,
pub metadata: HashMap<String, String>,
}Expand description
Information about a topic
Fields§
§topic: StringTopic path (e.g., “/sensor/camera/rgb”)
message_type: StringMessage type name (e.g., “Image”, “LaserScan”)
publishers: Vec<String>Nodes that publish to this topic
subscribers: Vec<String>Nodes that subscribe to this topic
created_at: u64When the topic was first registered
last_publisher_added: Option<u64>Last time a publisher was added
last_subscriber_added: Option<u64>Last time a subscriber was added
description: Option<String>Optional description
metadata: HashMap<String, String>Custom metadata
Implementations§
Source§impl TopicInfo
impl TopicInfo
Sourcepub fn add_publisher(&mut self, node_id: &str)
pub fn add_publisher(&mut self, node_id: &str)
Add a publisher
Sourcepub fn add_subscriber(&mut self, node_id: &str)
pub fn add_subscriber(&mut self, node_id: &str)
Add a subscriber
Sourcepub fn remove_publisher(&mut self, node_id: &str)
pub fn remove_publisher(&mut self, node_id: &str)
Remove a publisher
Sourcepub fn remove_subscriber(&mut self, node_id: &str)
pub fn remove_subscriber(&mut self, node_id: &str)
Remove a subscriber
Sourcepub fn has_publishers(&self) -> bool
pub fn has_publishers(&self) -> bool
Check if topic has any publishers
Sourcepub fn has_subscribers(&self) -> bool
pub fn has_subscribers(&self) -> bool
Check if topic has any subscribers
Sourcepub fn is_orphaned(&self) -> bool
pub fn is_orphaned(&self) -> bool
Check if topic is orphaned (no publishers or no subscribers)
Sourcepub fn publisher_count(&self) -> usize
pub fn publisher_count(&self) -> usize
Get the number of publishers
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Get the number of subscribers
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TopicInfo
impl<'de> Deserialize<'de> for TopicInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TopicInfo
impl RefUnwindSafe for TopicInfo
impl Send for TopicInfo
impl Sync for TopicInfo
impl Unpin for TopicInfo
impl UnwindSafe for TopicInfo
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more