aboutsummaryrefslogtreecommitdiffstats
path: root/src/wireguard/router/runq.rs
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2019-12-09 13:38:08 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2019-12-09 13:38:08 +0100
commit3b376cd6fba75787b08bb9bed8413a0d40998c26 (patch)
treea951aeb5ab0d7b48396593832c48388d6df27ece /src/wireguard/router/runq.rs
parentMerge branch 'runq' of ssh://git.zx2c4.com/wireguard-rs into runq (diff)
downloadwireguard-rs-3b376cd6fba75787b08bb9bed8413a0d40998c26.tar.xz
wireguard-rs-3b376cd6fba75787b08bb9bed8413a0d40998c26.zip
Formatting
Diffstat (limited to '')
-rw-r--r--src/wireguard/router/runq.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/wireguard/router/runq.rs b/src/wireguard/router/runq.rs
index 6d96490..936a53c 100644
--- a/src/wireguard/router/runq.rs
+++ b/src/wireguard/router/runq.rs
@@ -1,6 +1,6 @@
+use std::hash::Hash;
use std::mem;
use std::sync::{Condvar, Mutex};
-use std::hash::Hash;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
@@ -11,18 +11,18 @@ pub trait ToKey {
fn to_key(&self) -> Self::Key;
}
-pub struct RunQueue<T : ToKey> {
+pub struct RunQueue<T: ToKey> {
cvar: Condvar,
inner: Mutex<Inner<T>>,
}
-struct Inner<T : ToKey> {
+struct Inner<T: ToKey> {
stop: bool,
queue: VecDeque<T>,
members: HashMap<T::Key, usize>,
}
-impl<T : ToKey> RunQueue<T> {
+impl<T: ToKey> RunQueue<T> {
pub fn close(&self) {
let mut inner = self.inner.lock().unwrap();
inner.stop = true;
@@ -33,7 +33,7 @@ impl<T : ToKey> RunQueue<T> {
RunQueue {
cvar: Condvar::new(),
inner: Mutex::new(Inner {
- stop:false,
+ stop: false,
queue: VecDeque::new(),
members: HashMap::new(),
}),
@@ -111,8 +111,8 @@ impl<T : ToKey> RunQueue<T> {
#[cfg(test)]
mod tests {
use super::*;
- use std::thread;
use std::sync::Arc;
+ use std::thread;
use std::time::Duration;
/*
@@ -142,4 +142,4 @@ mod tests {
}
*/
-} \ No newline at end of file
+}