Struct Filter

Source
pub struct Filter { /* private fields */ }
Expand description

Filter builder - Construct your filter to filter out server results

§Quick Start

use msq::Filter;

let filter = Filter::new()      // Create a Filter builder
        .appid(240)             // appid of 240 (CS:S)
        .nand()                 // Start of NAND special filter
            .map("de_dust2")        // Map is de_dust2
            .empty(true)            // Server is empty
        .end()                  // End of NAND special filter
        .gametype(&vec!["friendlyfire", "alltalk"]);

Implementations§

Source§

impl Filter

Source

pub fn as_str(&self) -> String

👎Deprecated since 0.2.0: Replaced with as_string (name change)

Returns a string representing the filters

Source

pub fn as_string(&self) -> String

Returns a string representing the filters

Source

pub fn new() -> Filter

Returns a new Filter struct, used for string builder

§Examples
// Filter
use msq::Filter;
let filter = Filter::new()
    .appid(240)
    .full(false)
    .map("de_dust2");
Source

pub fn nor(self) -> Filter

A special filter, specifies that servers matching any of the following [x] conditions should not be returned. See end method to see examples on usage.

Source

pub fn nand(self) -> Filter

A special filter, specifies that servers matching all of the following [x] conditions should not be returned. See end method to see examples on usage.

Source

pub fn end(self) -> Filter

End the special filter (nor, nand) You must use this method after each nor/nand special filter method being used

§Examples

Using the NAND filter:

use msq::Filter;
let filter = Filter::new()
    .appid(240)
    .nand()     // Exclude servers that has de_dust2 AND is empty
        .map("de_dust2")
        .empty(true)
    .end()      // Ends the NAND special filter
    .gametype(&vec!["friendlyfire", "alltalk"]);

Using the NOR filter:

use msq::Filter;
let filter = Filter::new()
    .appid(240)
    .nor()      // Exclude servers that has de_dust2 OR is empty
        .map("de_dust2")
        .empty(true)
    .end()      // Ends the NOR special filter
    .gametype(&vec!["friendlyfire", "alltalk"]);
Source

pub fn dedicated(self, is_dedicated: bool) -> Filter

Filters if the servers running dedicated

§Arguments
  • is_dedicated - true = dedicated, false = not dedicated
Source

pub fn secure(self, hasac: bool) -> Filter

Servers using anti-cheat technology (VAC, but potentially others as well)

§Arguments
  • hasac - true = secure, false = not secure
Source

pub fn gamedir(self, modg: &str) -> Filter

Servers running the specified modification (ex: cstrike)

§Arguments
  • modg - The modification name (ex: cstrike)
Source

pub fn map(self, mapn: &str) -> Filter

Servers running the specified map (ex: cs_italy)

§Arguments
  • mapn - The current map it’s playing (ex: cs_italy)
Source

pub fn linux(self, runslinux: bool) -> Filter

Servers running on a Linux platform

§Arguments
  • runslinux - true = Runs on Linux, false = Does not runs on Linux
Source

pub fn password(self, protected: bool) -> Filter

Servers that are password protected

§Arguments
  • protected - true = Password protected, false = Not password protected
Source

pub fn full(self, is_full: bool) -> Filter

Servers that are full

§Arguments
  • is_full - true = Server’s full, false = Server’s not full
Source

pub fn proxy(self, specprox: bool) -> Filter

Servers that are spectator proxies

§Arguments
  • specprox - true = A spectator proxies, false = Not a spectator proxies
Source

pub fn appid(self, appid: u32) -> Filter

Servers that are running game [appid]

§Arguments
  • appid - The appid of the server: (EX: 240 (for CS:S))
Source

pub fn napp(self, appid: u32) -> Filter

Servers that are NOT running game [appid]

§Arguments
  • appid - The appid of the server: (EX: 240 (for CS:S))
Source

pub fn empty(self, is_empty: bool) -> Filter

Servers that are empty

§Arguments
  • is_empty - true = Empty, false = Not empty
Source

pub fn whitelisted(self, white: bool) -> Filter

Servers that are whitelisted

§Arguments
  • white - true = Whitelisted, false = Not whitelisted
Source

pub fn gametype(self, tags: &Vec<&str>) -> Filter

Servers with all of the given tag(s) in sv_tags

§Arguments
  • tags - A vector of strings which represents a tag from sv_tags
§Example
use msq::Filter;
let filter = Filter::new()
    .appid(240)
    .gametype(&vec!["friendlyfire", "alltalk"]);

If you put in an empty vector, it will return nothing

Source

pub fn gamedata(self, tags: &Vec<&str>) -> Filter

Servers with all of the given tag(s) in their ‘hidden’ tags (L4D2)

§Arguments
  • tags - A vector of strings which represents a tag from sv_tags
Source

pub fn gamedataor(self, tags: &Vec<&str>) -> Filter

Servers with any of the given tag(s) in their ‘hidden’ tags (L4D2)

§Arguments
  • tags - A vector of strings which represents a tag from sv_tags
Source

pub fn name_match(self, hostname: &str) -> Filter

Servers with their hostname matching [hostname] (can use * as a wildcard)

§Arguments
  • hostname - String of matching hostname (EX: 1.2.*)
Source

pub fn version_match(self, ver: &str) -> Filter

Servers running version [version] (can use * as a wildcard)

§Arguments
  • ver - String of matching version
Source

pub fn collapse_addr_hash(self, one_server: bool) -> Filter

Return only one server for each unique IP address matched

§Arguments
  • one_server - true = Return one server
Source

pub fn gameaddr(self, ipaddr: &str) -> Filter

Return only servers on the specified IP address (port supported and optional)

§Arguments
  • ipaddr - String of the IP address to match

Auto Trait Implementations§

§

impl Freeze for Filter

§

impl RefUnwindSafe for Filter

§

impl Send for Filter

§

impl Sync for Filter

§

impl Unpin for Filter

§

impl UnwindSafe for Filter

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.