From a1b1435b72d1287fd404541f4f5c24ae496aa9fe Mon Sep 17 00:00:00 2001 From: wrk Date: Fri, 2 Jun 2023 00:20:46 +0200 Subject: [PATCH] Added AnyArguments --- src/system_params.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/system_params.rs b/src/system_params.rs index be101cf..b8b0dc3 100644 --- a/src/system_params.rs +++ b/src/system_params.rs @@ -108,6 +108,28 @@ impl<'a> SystemParam for IrcPrefix<'a> { } } +pub struct AnyArguments<'a>(&'a [&'a str]); + +impl<'a> Deref for AnyArguments<'a> { + type Target = &'a [&'a str]; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl<'a> SystemParam for AnyArguments<'a> { + type Item<'new> = AnyArguments<'new>; + + fn retrieve<'r>( + _prefix: &'r IrcPrefix, + arguments: &'r [&'r str], + _factory: &'r Factory, + ) -> Self::Item<'r> { + AnyArguments(&arguments) + } +} + pub struct Arguments<'a, const N: usize>(&'a [&'a str]); impl<'a, const N: usize> Deref for Arguments<'a, N> {