pub enum Frame {
Show 32 variants
SimpleString(Bytes),
Error(Bytes),
Integer(i64),
BulkString(Option<Bytes>),
BlobError(Bytes),
StreamedStringHeader,
StreamedBlobErrorHeader,
StreamedVerbatimStringHeader,
StreamedArrayHeader,
StreamedSetHeader,
StreamedMapHeader,
StreamedAttributeHeader,
StreamedPushHeader,
StreamedStringChunk(Bytes),
StreamedString(Vec<Bytes>),
StreamedArray(Vec<Frame>),
StreamedSet(Vec<Frame>),
StreamedMap(Vec<(Frame, Frame)>),
StreamedAttribute(Vec<(Frame, Frame)>),
StreamedPush(Vec<Frame>),
StreamTerminator,
Null,
Double(f64),
SpecialFloat(Bytes),
Boolean(bool),
BigNumber(Bytes),
VerbatimString(Bytes, Bytes),
Array(Option<Vec<Frame>>),
Set(Vec<Frame>),
Map(Vec<(Frame, Frame)>),
Attribute(Vec<(Frame, Frame)>),
Push(Vec<Frame>),
}Expand description
A parsed RESP3 frame.
Each variant corresponds to one of the RESP3 types, including both fixed-length and streaming headers for bulk strings, arrays, sets, maps, attributes, and pushes.
Variants§
SimpleString(Bytes)
Simple string: +<string>\r\n
Error(Bytes)
Simple error: -<error>\r\n
Integer(i64)
Integer: :<number>\r\n
BulkString(Option<Bytes>)
Blob string: $<length>\r\n<bytes>\r\n
BlobError(Bytes)
Blob error: !<length>\r\n<bytes>\r\n
StreamedStringHeader
Streaming blob string header: $?\r\n
StreamedBlobErrorHeader
Streaming blob error header: !?\r\n
StreamedVerbatimStringHeader
Streaming verbatim string header: =?\r\n
StreamedArrayHeader
Streaming array header: *?\r\n
StreamedSetHeader
Streaming set header: ~?\r\n
StreamedMapHeader
Streaming map header: %?\r\n
StreamedAttributeHeader
Streaming attribute header: |?\r\n
StreamedPushHeader
Streaming push header: >?\r\n
StreamedStringChunk(Bytes)
Streaming string chunk: ;length\r\ndata\r\n
Represents an individual chunk in a streaming string sequence.
These chunks are parsed from ;{length}\r\n{data}\r\n format.
A zero-length chunk (;0\r\n) indicates the end of the stream.
§Example
use resp_rs::resp3::Frame;
use bytes::Bytes;
// Chunk containing "Hello"
// Wire format: ;5\r\nHello\r\n
Frame::StreamedStringChunk(Bytes::from("Hello"));StreamedString(Vec<Bytes>)
Accumulated streaming string data from multiple chunks
Created by parse_streaming_sequence() when parsing a complete
streaming string sequence ($?\r\n + chunks + ;0\r\n).
Contains all chunks in order, allowing reconstruction of the full string.
§Example
use resp_rs::resp3::Frame;
use bytes::Bytes;
// Represents "Hello world" from chunks ["Hello ", "world"]
Frame::StreamedString(vec![
Bytes::from("Hello "),
Bytes::from("world")
]);StreamedArray(Vec<Frame>)
Accumulated streaming array data from multiple chunks
Created when parsing a streaming array sequence (*?\r\n + frames + .\r\n).
Contains all frames that were streamed as part of the array.
§Example
use resp_rs::resp3::Frame;
use bytes::Bytes;
// Array with mixed types
Frame::StreamedArray(vec![
Frame::SimpleString(Bytes::from("hello")),
Frame::Integer(42),
Frame::Boolean(true)
]);StreamedSet(Vec<Frame>)
Accumulated streaming set data from multiple chunks
Created when parsing a streaming set sequence (~?\r\n + frames + .\r\n).
Contains all unique elements that were streamed as part of the set.
StreamedMap(Vec<(Frame, Frame)>)
Accumulated streaming map data from multiple chunks
Created when parsing a streaming map sequence (%?\r\n + key-value pairs + .\r\n).
Contains all key-value pairs that were streamed as part of the map.
§Example
use resp_rs::resp3::Frame;
use bytes::Bytes;
Frame::StreamedMap(vec![
(Frame::SimpleString(Bytes::from("name")), Frame::SimpleString(Bytes::from("Alice"))),
(Frame::SimpleString(Bytes::from("age")), Frame::Integer(25))
]);StreamedAttribute(Vec<(Frame, Frame)>)
Accumulated streaming attribute data from multiple chunks
Created when parsing a streaming attribute sequence (|?\r\n + key-value pairs + .\r\n).
Attributes provide out-of-band metadata that doesn’t affect the main data structure.
StreamedPush(Vec<Frame>)
Accumulated streaming push data from multiple chunks
Created when parsing a streaming push sequence (>?\r\n + frames + .\r\n).
Push messages are server-initiated communications (e.g., pub/sub messages).
§Example
use resp_rs::resp3::Frame;
use bytes::Bytes;
// Pub/sub message
Frame::StreamedPush(vec![
Frame::SimpleString(Bytes::from("pubsub")),
Frame::SimpleString(Bytes::from("channel1")),
Frame::SimpleString(Bytes::from("message content"))
]);StreamTerminator
End-of-stream terminator for all chunked sequences: .\r\n
Null
Null: _\r\n
Double(f64)
Double: ,<float>\r\n
SpecialFloat(Bytes)
Special Float: ,inf\r\n, -inf\r\n, nan\r\n
Boolean(bool)
Boolean: #t\r\n or #f\r\n
BigNumber(Bytes)
Big number: (<number>\r\n
VerbatimString(Bytes, Bytes)
Verbatim string: =format:content\r\n
Array(Option<Vec<Frame>>)
Array: *<count>\r\n… (or streaming header *?\r\n)
Set(Vec<Frame>)
Set: ~<count>\r\n… (or streaming header ~?\r\n)
Map(Vec<(Frame, Frame)>)
Map: %<count>\r\n… (or streaming header %?\r\n)
Attribute(Vec<(Frame, Frame)>)
Attribute: |<count>\r\n… (or streaming header |?\r\n)
Push(Vec<Frame>)
Push: > <count>\r\n… (or streaming header >?\r\n)