Skip to content

Commit 66f1f65

Browse files
committed
fix: Script operations use more generic client
allow any type that implements the LuaInterface trait instead of only allowing the Client type
1 parent f222ad7 commit 66f1f65

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/types/scripts.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ impl Script {
195195
/// called once before calling [evalsha](Self::evalsha).
196196
#[cfg(feature = "sha-1")]
197197
#[cfg_attr(docsrs, doc(cfg(feature = "sha-1")))]
198-
pub async fn load(&self, client: &Client) -> FredResult<()> {
198+
pub async fn load<C>(&self, client: C) -> FredResult<()>
199+
where
200+
C: LuaInterface + Send,
201+
{
199202
if let Some(ref lua) = self.lua {
200203
client.script_load_cluster::<(), _>(lua.clone()).await
201204
} else {
@@ -219,9 +222,10 @@ impl Script {
219222
/// of `NOSCRIPT` error and try `EVALSHA` again.
220223
#[cfg(feature = "sha-1")]
221224
#[cfg_attr(docsrs, doc(cfg(feature = "sha-1")))]
222-
pub async fn evalsha_with_reload<R, K, V>(&self, client: &Client, keys: K, args: V) -> FredResult<R>
225+
pub async fn evalsha_with_reload<R, C, K, V>(&self, client: C, keys: K, args: V) -> FredResult<R>
223226
where
224227
R: FromValue,
228+
C: LuaInterface + Send,
225229
K: Into<MultipleKeys> + Send,
226230
V: TryInto<MultipleValues> + Send,
227231
V::Error: Into<Error> + Send,

0 commit comments

Comments
 (0)