From d63fe663de9dc11a86aa7629e147384357451ab8 Mon Sep 17 00:00:00 2001 From: Maple Nebel Date: Tue, 5 May 2026 14:48:25 +0200 Subject: [PATCH] fix attribs --- rnex-core/src/nex/matchmake.rs | 39 ++++++++++------------ rnex-core/src/rmc/structures/matchmake.rs | 4 ++- rnex-core/src/rmc/structures/string_set.rs | 4 +-- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/rnex-core/src/nex/matchmake.rs b/rnex-core/src/nex/matchmake.rs index 686f3bb..42ca97c 100644 --- a/rnex-core/src/nex/matchmake.rs +++ b/rnex-core/src/nex/matchmake.rs @@ -399,31 +399,28 @@ impl ExtendedMatchmakeSession { #[cfg(feature = "splatoon")] { - if search_criteria - .attribs - .get(0) - .map(|str| str.parse().ok()) - .flatten() - != self.session.attributes.get(0).map(|v| *v) - { + if search_criteria.attribs.get(0).is_some_and(|s| { + self.session + .attributes + .get(0) + .is_some_and(|a| s.0.contains(a)) + }) { return Ok(false); } - if search_criteria - .attribs - .get(2) - .map(|str| str.parse().ok()) - .flatten() - != self.session.attributes.get(2).map(|v| *v) - { + if search_criteria.attribs.get(2).is_some_and(|s| { + self.session + .attributes + .get(2) + .is_some_and(|a| s.0.contains(a)) + }) { return Ok(false); } - if search_criteria - .attribs - .get(3) - .map(|str| str.parse().ok()) - .flatten() - != self.session.attributes.get(3).map(|v| *v) - { + if search_criteria.attribs.get(3).is_some_and(|s| { + self.session + .attributes + .get(3) + .is_some_and(|a| s.0.contains(a)) + }) { return Ok(false); } } diff --git a/rnex-core/src/rmc/structures/matchmake.rs b/rnex-core/src/rmc/structures/matchmake.rs index aeb26ff..88deea0 100644 --- a/rnex-core/src/rmc/structures/matchmake.rs +++ b/rnex-core/src/rmc/structures/matchmake.rs @@ -5,6 +5,8 @@ use rnex_core::rmc::structures::variant::Variant; use rnex_core::PID; +use crate::rmc::structures::string_set::StringSet; + // rmc structure #[derive(RmcSerialize, Debug, Clone, Default, PartialEq)] #[rmc_struct(0)] @@ -75,7 +77,7 @@ cfg_if! { #[derive(RmcSerialize, Debug, Clone)] #[rmc_struct(3)] pub struct MatchmakeSessionSearchCriteria { - pub attribs: Vec, + pub attribs: Vec>, pub game_mode: String, pub minimum_participants: String, pub maximum_participants: String, diff --git a/rnex-core/src/rmc/structures/string_set.rs b/rnex-core/src/rmc/structures/string_set.rs index 9526a4e..7c55507 100644 --- a/rnex-core/src/rmc/structures/string_set.rs +++ b/rnex-core/src/rmc/structures/string_set.rs @@ -2,8 +2,8 @@ use std::{collections::HashSet, hash::Hash, str::FromStr, string::ToString}; use rnex_core::rmc::structures::RmcSerialize; -#[derive(Debug)] -struct StringSet(HashSet) +#[derive(Debug, Clone)] +pub struct StringSet(pub HashSet) where ::Err: std::error::Error + Send + Sync + 'static;