Snippets

Eric Young Iterator filtering fun

Updated by Eric Young

File filter Deleted

  • Ignore whitespace
  • Hide word diff
-pub fn get_filtered_players(&self, name: Option<String>, uuid: Option<String>, whitelisted: Option<bool>, op: Option<bool>, online: Option<bool>) -> Vec<&MinecraftPlayer> {
-        self.players.values().filter(|&player| {
-            match name.as_ref() {
-                Some(name) => name.to_lowercase() == player.name,
-                None => true
-            }
-        }).filter(|&player| {
-            match uuid.as_ref() {
-                Some(uuid) => uuid == &player.uuid,
-                None => true
-            }
-        }).filter(|&player| {
-            match whitelisted {
-                Some(whitelisted) => whitelisted == player.white_listed,
-                None => true
-            }
-        }).filter(|&player| {
-            match op {
-                Some(op) => op == player.op,
-                None => true
-            }
-        }).filter(|&player| {
-            match online {
-                Some(online) => online == player.online,
-                None => true
-            }
-        }).collect()
-    }

File filter.rs Added

  • Ignore whitespace
  • Hide word diff
+pub fn get_filtered_players(&self, name: Option<String>, uuid: Option<String>, whitelisted: Option<bool>, op: Option<bool>, online: Option<bool>) -> Vec<&MinecraftPlayer> {
+        self.players.values().filter(|&player| {
+            match name.as_ref() {
+                Some(name) => name.to_lowercase() == player.name,
+                None => true
+            }
+        }).filter(|&player| {
+            match uuid.as_ref() {
+                Some(uuid) => uuid == &player.uuid,
+                None => true
+            }
+        }).filter(|&player| {
+            match whitelisted {
+                Some(whitelisted) => whitelisted == player.white_listed,
+                None => true
+            }
+        }).filter(|&player| {
+            match op {
+                Some(op) => op == player.op,
+                None => true
+            }
+        }).filter(|&player| {
+            match online {
+                Some(online) => online == player.online,
+                None => true
+            }
+        }).collect()
+    }
Created by Eric Young

File filter Added

  • Ignore whitespace
  • Hide word diff
+pub fn get_filtered_players(&self, name: Option<String>, uuid: Option<String>, whitelisted: Option<bool>, op: Option<bool>, online: Option<bool>) -> Vec<&MinecraftPlayer> {
+        self.players.values().filter(|&player| {
+            match name.as_ref() {
+                Some(name) => name.to_lowercase() == player.name,
+                None => true
+            }
+        }).filter(|&player| {
+            match uuid.as_ref() {
+                Some(uuid) => uuid == &player.uuid,
+                None => true
+            }
+        }).filter(|&player| {
+            match whitelisted {
+                Some(whitelisted) => whitelisted == player.white_listed,
+                None => true
+            }
+        }).filter(|&player| {
+            match op {
+                Some(op) => op == player.op,
+                None => true
+            }
+        }).filter(|&player| {
+            match online {
+                Some(online) => online == player.online,
+                None => true
+            }
+        }).collect()
+    }
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.