rmp_ipc/namespaces/namespace.rs
1use crate::events::event_handler::EventHandler;
2use std::sync::Arc;
3
4#[derive(Clone, Debug)]
5pub struct Namespace {
6 name: String,
7 pub(crate) handler: Arc<EventHandler>,
8}
9
10impl Namespace {
11 /// Creates a new namespace with an event handler to register event callbacks on
12 pub fn new<S: ToString>(name: S, handler: EventHandler) -> Self {
13 Self {
14 name: name.to_string(),
15 handler: Arc::new(handler),
16 }
17 }
18
19 pub fn name(&self) -> &String {
20 &self.name
21 }
22}