Expand description

Builder for constructing RESP2/3 frames

Generic wrapper mainly used as helper for creating RESP frames. However, it can also be used to execute custom/arbitrary commands. See CustomCommand for more details.

Creating generic frames

The following example demonstrates the creation of command frame for HGET.

use embedded_redis::commands::builder::CommandBuilder;
use redis_protocol::resp2::types::Frame as Resp2Frame;

let _frame: Resp2Frame = CommandBuilder::new("HGET")
    .arg_static("field1")
    .arg_static("foo")
    .into();

Improved performance

For best performance, especially with large amounts of data, it is recommended to use Bytes.

use embedded_redis::commands::builder::CommandBuilder;
// Using Bytes avoids data copy, as clone() is shallow
let value = Bytes::from_static("Large value".as_bytes());

let _frame: Resp2Frame = CommandBuilder::new("HSET")
    .arg_static("myhash")
    .arg_static("field1")
    .arg(&value)
    .into();

Structs

Builder for constructing RESP2/3 frames

Traits

Unification for null check of RESP2/3 frames

Unification for extracting integer value of Frames

Trait for string extraction of RESP2/3 frames

Unification for to_string() of RESP2/3 frames