aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2021-05-03 08:20:40 +0200
committerAndreas Grois <andi@grois.info>2021-05-03 08:20:40 +0200
commit0b6a4634675f27b88bb61b54f2b3711d0cd2f1a0 (patch)
treebfccbfb31a64a33ae5b0b0ed0c7bfb38883d2282
parentb41d3d0b383b27e583f4d3f108ae9dcd48090ca8 (diff)
Revert "Make runnable's run() method take a mutable self-reference."
This reverts commit e1f0525e4e1dcf674aa7489042a06b7c7d671a2a. I've decided against having mutable self-references. It's a bit less convenient, but more sane. Also, the revert can be reverted any time, should the need arise.
-rw-r--r--clock/src/lib.rs2
-rw-r--r--pulse/src/runnable/mod.rs2
-rw-r--r--swaystatus-plugin/src/lib.rs2
-rw-r--r--swaystatus/src/main.rs2
-rw-r--r--swaystatus/src/test_plugin.rs2
5 files changed, 5 insertions, 5 deletions
diff --git a/clock/src/lib.rs b/clock/src/lib.rs
index 8055449..76f5ea7 100644
--- a/clock/src/lib.rs
+++ b/clock/src/lib.rs
@@ -76,7 +76,7 @@ impl<'c> ClockRunnable<'c> {
}
impl<'c> SwayStatusModuleRunnable for ClockRunnable<'c> {
- fn run(&mut self) {
+ fn run(&self) {
match self.config.refresh_rate {
ClockRefreshRate::NotSynchronized { seconds } => {
self.simple_loop(std::time::Duration::from_secs_f32(seconds.abs()));
diff --git a/pulse/src/runnable/mod.rs b/pulse/src/runnable/mod.rs
index ca63f24..612bca9 100644
--- a/pulse/src/runnable/mod.rs
+++ b/pulse/src/runnable/mod.rs
@@ -28,7 +28,7 @@ impl<'p : 's, 's> PulseVolumeRunnable<'p> {
}
impl<'p> SwayStatusModuleRunnable for PulseVolumeRunnable<'p> {
- fn run(&mut self) {
+ fn run(&self) {
//TODO
}
}
diff --git a/swaystatus-plugin/src/lib.rs b/swaystatus-plugin/src/lib.rs
index a9859c8..8a632cf 100644
--- a/swaystatus-plugin/src/lib.rs
+++ b/swaystatus-plugin/src/lib.rs
@@ -156,7 +156,7 @@ pub trait SwayStatusModule {
///Will be called in a worker thread.
pub trait SwayStatusModuleRunnable : Send {
///Starts executing this module.
- fn run(&mut self);
+ fn run(&self);
}
///Implement this trait on a struct that holds the configuration for a single instance of your
diff --git a/swaystatus/src/main.rs b/swaystatus/src/main.rs
index c1c1b73..e4847d9 100644
--- a/swaystatus/src/main.rs
+++ b/swaystatus/src/main.rs
@@ -89,7 +89,7 @@ fn core_loop(plugin_path : &std::path::Path, config_path : &std::path::Path) ->
// Main everything is ready for the big main loop. Let's spawn the threads!
if let Err(_e) = thread::scope(|s| {
signalhandler::handle_signals(s, sender_from_plugins);
- for mut runnable in runnables {
+ for runnable in runnables {
s.spawn(move |_| {
runnable.run();
});
diff --git a/swaystatus/src/test_plugin.rs b/swaystatus/src/test_plugin.rs
index c82366d..4e265e2 100644
--- a/swaystatus/src/test_plugin.rs
+++ b/swaystatus/src/test_plugin.rs
@@ -28,7 +28,7 @@ pub struct TestConfig {
}
impl SwayStatusModuleRunnable for TestRunnable {
- fn run(&mut self) {
+ fn run(&self) {
println!("Running!");
}
}