mirror of https://github.com/Trivernis/bromine.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
516 B
Rust
23 lines
516 B
Rust
use crate::events::event_handler::EventHandler;
|
|
use std::sync::Arc;
|
|
|
|
#[derive(Clone)]
|
|
pub struct Namespace {
|
|
name: String,
|
|
pub(crate) handler: Arc<EventHandler>,
|
|
}
|
|
|
|
impl Namespace {
|
|
/// Creates a new namespace with an event handler to register event callbacks on
|
|
pub fn new<S: ToString>(name: S, handler: EventHandler) -> Self {
|
|
Self {
|
|
name: name.to_string(),
|
|
handler: Arc::new(handler),
|
|
}
|
|
}
|
|
|
|
pub fn name(&self) -> &String {
|
|
&self.name
|
|
}
|
|
}
|