Make recipient of SpircManager methods non-mut.

SpircManager has interior mutability using a Mutex. There’s no need to
make it’s methods take a mut reference.
This commit is contained in:
Paul Lietar 2016-02-19 00:03:08 +00:00
parent 72dc5025c0
commit 95d1dfd774

View file

@ -75,7 +75,7 @@ impl SpircManager {
}))) })))
} }
pub fn run(&mut self) { pub fn run(&self) {
let rx = { let rx = {
let mut internal = self.0.lock().unwrap(); let mut internal = self.0.lock().unwrap();
@ -115,28 +115,28 @@ impl SpircManager {
self.0.lock().unwrap().devices.clone() self.0.lock().unwrap().devices.clone()
} }
pub fn send_play(&mut self, recipient: &str) { pub fn send_play(&self, recipient: &str) {
let mut internal = self.0.lock().unwrap(); let mut internal = self.0.lock().unwrap();
CommandSender::new(&mut *internal, MessageType::kMessageTypePlay) CommandSender::new(&mut *internal, MessageType::kMessageTypePlay)
.recipient(recipient) .recipient(recipient)
.send(); .send();
} }
pub fn send_pause(&mut self, recipient: &str) { pub fn send_pause(&self, recipient: &str) {
let mut internal = self.0.lock().unwrap(); let mut internal = self.0.lock().unwrap();
CommandSender::new(&mut *internal, MessageType::kMessageTypePause) CommandSender::new(&mut *internal, MessageType::kMessageTypePause)
.recipient(recipient) .recipient(recipient)
.send(); .send();
} }
pub fn send_prev(&mut self, recipient: &str) { pub fn send_prev(&self, recipient: &str) {
let mut internal = self.0.lock().unwrap(); let mut internal = self.0.lock().unwrap();
CommandSender::new(&mut *internal, MessageType::kMessageTypePrev) CommandSender::new(&mut *internal, MessageType::kMessageTypePrev)
.recipient(recipient) .recipient(recipient)
.send(); .send();
} }
pub fn send_next(&mut self, recipient: &str) { pub fn send_next(&self, recipient: &str) {
let mut internal = self.0.lock().unwrap(); let mut internal = self.0.lock().unwrap();
CommandSender::new(&mut *internal, MessageType::kMessageTypeNext) CommandSender::new(&mut *internal, MessageType::kMessageTypeNext)
.recipient(recipient) .recipient(recipient)