Module resp3

Module resp3 

Source
Expand description

RESP3 (Redis Serialization Protocol version 3) implementation

RESP3 is the new protocol introduced in Redis 6.0 that extends RESP2 with additional data types and improved semantics. This module provides full RESP3 support while maintaining backward compatibility with RESP2.

§New RESP3 Data Types

  • Map: Key-value pairs (similar to hash tables)
  • Set: Unordered collection of unique elements
  • Attribute: Metadata attached to other types
  • Push: Server-initiated messages (pub/sub, monitoring)
  • Boolean: True/false values
  • Double: IEEE 754 floating point numbers
  • BigNumber: Arbitrary precision numbers
  • VerbatimString: Strings with encoding information
  • Null: Explicit null value

§Examples

use redis_oxide::protocol::resp3::{Resp3Value, Resp3Encoder, Resp3Decoder};
use std::collections::HashMap;

// Create a RESP3 map
let mut map = HashMap::new();
map.insert("name".to_string(), Resp3Value::BlobString("Alice".to_string()));
map.insert("age".to_string(), Resp3Value::Number(30));
let value = Resp3Value::Map(map);

// Encode to bytes
let mut encoder = Resp3Encoder::new();
let encoded = encoder.encode(&value)?;

// Decode back
let mut decoder = Resp3Decoder::new();
let decoded = decoder.decode(&encoded)?;

Structs§

Resp3Decoder
RESP3 protocol decoder
Resp3Encoder
RESP3 protocol encoder

Enums§

Resp3Value
RESP3 protocol data types