moonbitstack/moonredis/resp does not have a README file

    RespError

    pub(all) suberror RespError {
    RespError(String)
    }

    A malformed or truncated RESP frame.

    RespReader

    pub struct RespReader {
    data : Bytes
    pos : Int
    }

    A cursor over a RESP byte stream, decoding one value at a time. A socket client feeds it a buffered reply; read advances past exactly one value, so several pipelined replies decode in sequence.

    RespReader::at_end

    fn RespReader::at_end(self : RespReader) -> Bool

    Whether every byte has been consumed.

    RespReader::decode_first

    fn RespReader::decode_first(self : RespReader) -> RespValue raise RespError

    Decode the first RESP value from data, leaving any trailing bytes for the caller (a socket reader feeds a buffered reply and decodes pipelined replies one at a time).

    RespReader::new

    fn RespReader::new(data : Bytes) -> RespReader

    A reader positioned at the start of data.

    RespReader::read

    fn RespReader::read(self : RespReader) -> RespValue raise RespError

    Decode the next RESP value, advancing the cursor past it.

    RespReader::rest

    fn RespReader::rest(self : RespReader) -> Bytes

    The bytes from the cursor to the end, as a fresh slice (the remainder of a stream).

    RespValue

    pub(all) enum RespValue {
    SimpleString(String)
    Error(String)
    Integer(Int64)
    BulkString(Bytes)
    Null
    Array(Array[RespValue])
    Boolean(Bool)
    Double(Double)
    BigNumber(String)
    BulkError(String)
    VerbatimString(String, Bytes)
    RespMap(Array[(RespValue, RespValue)])
    RespSet(Array[RespValue])
    Push(Array[RespValue])
    } derive(Eq,
    Debug
    )

    A decoded RESP value. RESP2's null bulk string ($-1) and null array (*-1) both decode to Null, unifying with RESP3's explicit null (_). BulkString carries raw bytes (redis values are binary-safe); the text-line types carry the decoded string.

    RespValue::decode

    fn RespValue::decode(data : Bytes) -> RespValue raise RespError

    Decode exactly one RESP value from data, requiring it to consume the whole input. Trailing bytes after a complete value are a framing error.

    RespValue::encode

    fn RespValue::encode(self : RespValue) -> Bytes

    Encode a value back to its RESP wire form. Every type that decodes also encodes, so a value round-trips through bytes unchanged; the documentation site uses this to show the bytes a decoded value becomes.

    RespValue::encode_into

    fn RespValue::encode_into(self : RespValue, buf :
    Buffer
    ) -> Unit

    Append a value's RESP wire form to buf.

    RespValue::equal

    fn RespValue::equal(RespValue, RespValue) -> Bool

    RespValue::not_equal

    fn RespValue::not_equal(x : RespValue, y : RespValue) -> Bool

    resp_command

    fn resp_command(args : Array[String]) -> Bytes

    Encode a command given string arguments (the common case — command names and keys are text), UTF-8 encoding each.

    resp_encode_command

    fn resp_encode_command(args : Array[Bytes]) -> Bytes

    Encode a command as the client frame redis expects: an array of bulk strings, one per argument (*<n>\r\n$<len>\r\n<arg>\r\n...). Arguments are raw bytes, so binary keys and values round-trip unchanged.

    resp_kind

    fn resp_kind(value : RespValue) -> String

    A short name for a value's RESP type, for error messages ("unexpected <kind> reply") — RespValue derives Eq/Debug but not a renderable form.

    Source Files

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io