pub struct Script { /* private fields */ }
Available on crate feature
i-scripts
only.Expand description
An interface for caching and running lua scripts.
async fn example(client: &Client) -> Result<(), Error> {
let script = Script::from_lua("return ARGV[1]");
assert_eq!(script.sha1(), "098e0f0d1448c0a81dafe820f66d460eb09263da");
let _ = script.load(client).await?;
let result: String = script.evalsha(client, "key", "arg").await?;
assert_eq!(result, "arg");
Ok(())
}
Implementations§
Source§impl Script
impl Script
Sourcepub async fn evalsha<R, C, K, V>(
&self,
client: &C,
keys: K,
args: V,
) -> FredResult<R>where
R: FromValue,
C: LuaInterface + Send + Sync,
K: Into<MultipleKeys> + Send,
V: TryInto<MultipleValues> + Send,
V::Error: Into<Error> + Send,
pub async fn evalsha<R, C, K, V>(
&self,
client: &C,
keys: K,
args: V,
) -> FredResult<R>where
R: FromValue,
C: LuaInterface + Send + Sync,
K: Into<MultipleKeys> + Send,
V: TryInto<MultipleValues> + Send,
V::Error: Into<Error> + Send,
Send EVALSHA
to the server with the provided arguments.
Trait Implementations§
Source§impl Ord for Script
impl Ord for Script
Source§impl PartialOrd for Script
impl PartialOrd for Script
impl Eq for Script
impl StructuralPartialEq for Script
Auto Trait Implementations§
impl !Freeze for Script
impl RefUnwindSafe for Script
impl Send for Script
impl Sync for Script
impl Unpin for Script
impl UnwindSafe for Script
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more