Skip to main content

Module strings

Module strings 

Source
Expand description

The string type and its commands.

The commands are an impl block on Keyspace rather than methods on some per type object, because a key belongs to the database and not to a type. Everything in this file is about strings; everything that is about the database whatever it holds is in keyspace.

One method per Redis command, taking and returning ordinary Rust values. There is no command enum here and no dispatch: this is the layer the wire calls into and the layer the embedded API calls into, and Y23 says those two have to be the same code rather than two implementations of the same idea. Anything that is about parsing arguments or writing a reply lives above.

Errors carry Redis’s own message text, because it ends up on the wire verbatim, and a Code alongside it, because the embedded caller should be matching on a value rather than on a string (P5).

Structs§

SetOptions
Everything SET can be asked to do beyond storing the value.
SetOutcome
What a SET did.

Enums§

Exists
Whether a SET should go ahead given what is already there.
Expire
What a write should do with the key’s deadline.

Constants§

KEY_MAX
The longest key this band stores.
STRING_MAX
The largest string this band stores.

Functions§

check_len
Refuse a key or a value this band cannot hold.