From 1a37e31342abf4c095b1f7c6d0594c46554c0ede Mon Sep 17 00:00:00 2001 From: "brv.sh" Date: Sun, 24 Nov 2024 12:56:04 -0600 Subject: [PATCH] Add StringFilterKind exhaustive filters --- src/matchmaking.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/matchmaking.rs b/src/matchmaking.rs index e30123e..e9f54e8 100644 --- a/src/matchmaking.rs +++ b/src/matchmaking.rs @@ -491,10 +491,10 @@ impl Matchmaking { /// LobbyListFilter { /// string: Some(vec![ /// StringFilter( - /// LobbyKey::new("name"), "My Lobby", StringFilterKind::Include + /// LobbyKey::new("name"), "My Lobby", StringFilterKind::Equal /// ), /// StringFilter( - /// LobbyKey::new("gamemode"), "ffa", StringFilterKind::Include + /// LobbyKey::new("gamemode"), "ffa", StringFilterKind::Equal /// ), /// ]), /// number: Some(vec![ @@ -653,15 +653,23 @@ pub struct StringFilter<'a>( #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum StringFilterKind { #[default] - Include, - Exclude, + EqualToOrLessThan, + LessThan, + Equal, + GreaterThan, + EqualToOrGreaterThan, + NotEqual, } impl From for sys::ELobbyComparison { fn from(filter: StringFilterKind) -> Self { match filter { - StringFilterKind::Include => sys::ELobbyComparison::k_ELobbyComparisonEqual, - StringFilterKind::Exclude => sys::ELobbyComparison::k_ELobbyComparisonNotEqual, + StringFilterKind::EqualToOrLessThan=> sys::ELobbyComparison::k_ELobbyComparisonEqualToOrLessThan, + StringFilterKind::LessThan=> sys::ELobbyComparison::k_ELobbyComparisonLessThan, + StringFilterKind::Equal=> sys::ELobbyComparison::k_ELobbyComparisonEqual, + StringFilterKind::GreaterThan=> sys::ELobbyComparison::k_ELobbyComparisonGreaterThan, + StringFilterKind::EqualToOrGreaterThan=> sys::ELobbyComparison::k_ELobbyComparisonEqualToOrGreaterThan, + StringFilterKind::NotEqual=> sys::ELobbyComparison::k_ELobbyComparisonNotEqual, } } } @@ -1015,7 +1023,7 @@ fn test_lobby() { string: Some(vec![StringFilter( LobbyKey::new("name"), "My Lobby", - StringFilterKind::Include, + StringFilterKind::Equal, )]), ..Default::default() });