[−][src]Struct redis::Script
Represents a lua script.
Implementations
impl Script
[src]
The script object represents a lua script that can be executed on the redis server. The object itself takes care of automatic uploading and execution. The script object itself can be shared and is immutable.
Example:
let script = redis::Script::new(r" return tonumber(ARGV[1]) + tonumber(ARGV[2]); "); let result = script.arg(1).arg(2).invoke(&mut con); assert_eq!(result, Ok(3));
pub fn new(code: &str) -> Script
[src]
Creates a new script object.
pub fn get_hash(&self) -> &str
[src]
Returns the script's SHA1 hash in hexadecimal format.
pub fn key<T: ToRedisArgs>(&self, key: T) -> ScriptInvocation<'_>
[src]
Creates a script invocation object with a key filled in.
pub fn arg<T: ToRedisArgs>(&self, arg: T) -> ScriptInvocation<'_>
[src]
Creates a script invocation object with an argument filled in.
pub fn prepare_invoke(&self) -> ScriptInvocation<'_>
[src]
Returns an empty script invocation object. This is primarily useful
for programmatically adding arguments and keys because the type will
not change. Normally you can use arg
and key
directly.
pub fn invoke<T: FromRedisValue>(
&self,
con: &mut dyn ConnectionLike
) -> RedisResult<T>
[src]
&self,
con: &mut dyn ConnectionLike
) -> RedisResult<T>
Invokes the script directly without arguments.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Script
impl Send for Script
impl Sync for Script
impl Unpin for Script
impl UnwindSafe for Script
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,