fix mutability

master
eater 5 years ago
parent e247cfbe4a
commit f9528ccd48
Signed by: eater
GPG Key ID: AD2560A0F84F0759

@ -56,9 +56,9 @@ pub const NPC: c_ushort = 3;
#[macro_export] #[macro_export]
macro_rules! call_instance { macro_rules! call_instance {
($call:tt, $($argument:expr),+) => { ($call:tt, $($argument:expr),+) => {
let mut instance = unsafe { let instance = unsafe {
EVENTS_INSTANCE EVENTS_INSTANCE
.as_ref() .as_mut()
.expect(format!("No events instance created: {}\n", stringify!($call)).as_str()) .expect(format!("No events instance created: {}\n", stringify!($call)).as_str())
}; };
instance.$call($($argument),+); instance.$call($($argument),+);
@ -66,9 +66,9 @@ macro_rules! call_instance {
}; };
($call:tt) => { ($call:tt) => {
let mut instance = unsafe { let instance = unsafe {
EVENTS_INSTANCE EVENTS_INSTANCE
.as_ref() .as_mut()
.expect(format!("No events instance created: {}\n", stringify!($call)).as_str()) .expect(format!("No events instance created: {}\n", stringify!($call)).as_str())
}; };
instance.$call(); instance.$call();

@ -9,15 +9,15 @@ impl Events for Server {
Server Server
} }
fn on_any(&self, event: &str) { fn on_any(&mut self, event: &str) {
plugin::log_message(LOG_INFO, format!("Event triggered: {}", event).as_str()); plugin::log_message(LOG_INFO, format!("Event triggered: {}", event).as_str());
} }
fn on_server_init(&self) { fn on_server_init(&mut self) {
plugin::log_message(plugin::LOG_WARN, "Hello from Rust :3"); plugin::log_message(plugin::LOG_WARN, "Hello from Rust :3");
} }
fn on_server_post_init(&self) { fn on_server_post_init(&mut self) {
plugin::log_message(plugin::LOG_FATAL, "Hi!?"); plugin::log_message(plugin::LOG_FATAL, "Hi!?");
} }
} }

Loading…
Cancel
Save