Struct redis::Script[][src]

pub struct Script { /* fields omitted */ }
Expand description

Represents a lua script.

Implementations

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));

Creates a new script object.

Returns the script’s SHA1 hash in hexadecimal format.

Creates a script invocation object with a key filled in.

Creates a script invocation object with an argument filled in.

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.

Invokes the script directly without arguments.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.