platform_lp/
partialplatform.rs

1use Platform;
2
3/// Platform Partial, designed for 'fuzzy' comparisons.
4/// 
5/// ```rust
6/// use platform_lp::{ Platform, PartialPlatform};
7/// 
8/// let the_platform = Platform::get_user_platform();
9/// # let the_platform = Platform::Win64;
10/// assert!(the_platform == PartialPlatform::Windows);
11#[derive(Debug,PartialEq,Hash,Eq)]
12pub enum PartialPlatform {
13    Windows,
14    Linux,
15    Mac,
16}
17
18impl PartialEq<Platform> for PartialPlatform {
19    fn eq(&self, other: &Platform) -> bool {
20        match (self, other) {
21            (PartialPlatform::Linux, Platform::Nix64) => true,
22            (PartialPlatform::Linux, Platform::Nix32) => true,
23            (PartialPlatform::Windows, Platform::Win64) => true,
24            (PartialPlatform::Windows, Platform::Win32) => true,
25            (PartialPlatform::Mac, Platform::Mac64) => true,
26            (PartialPlatform::Mac, Platform::Mac32) => true,
27            (_,_) => false
28        }
29    }
30}