Skip to content

Commit 44099b5

Browse files
committed
Add .child() function to allow topic to act as prefix
1 parent 20f20e3 commit 44099b5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/topic.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ impl Topic {
109109
&mut self.name
110110
}
111111

112+
/// Creates a child topic
113+
pub fn child(&self, name: String){
114+
Topic::new(self.name.clone() + &*name, self.handle.clone());
115+
}
116+
112117
/// Publishes to this topic with the data type `T`.
113118
///
114119
/// For a generic-free version, see [`generic_publish`][`Self::generic_publish`].

0 commit comments

Comments
 (0)