#redis

resp

RESP(REdis Serialization Protocol) Serialization for Rust

21 releases (4 stable)

Uses old Rust 2015

1.0.3 Aug 19, 2022
1.0.2 Apr 11, 2017
1.0.0 Mar 26, 2017
0.4.0 Jun 5, 2016
0.3.5 Mar 27, 2016

#2239 in Database interfaces

Download history 29/week @ 2024-07-20 31/week @ 2024-07-27 20/week @ 2024-08-03 16/week @ 2024-08-10 11/week @ 2024-08-17 45/week @ 2024-08-24 35/week @ 2024-08-31 17/week @ 2024-09-07 13/week @ 2024-09-14 73/week @ 2024-09-21 62/week @ 2024-09-28 12/week @ 2024-10-05 14/week @ 2024-10-12 16/week @ 2024-10-19 15/week @ 2024-10-26 14/week @ 2024-11-02

59 downloads per month
Used in 5 crates

MIT/Apache

40KB
749 lines

RESP

RESP(REdis Serialization Protocol) Serialization for Rust.

Crates version Build Status Coverage Status Crates downloads Docs Status

Implementations:

API

extern crate resp;
use resp::{Value, encode, encode_slice, Decoder};

RESP Values

enum Value {
    /// Null bulk reply, $-1\r\n
    Null,
    /// Null array reply, *-1\r\n
    NullArray,
    /// For Simple Strings the first byte of the reply is "+"
    String(String),
    /// For Errors the first byte of the reply is "-"
    Error(String),
    /// For Integers the first byte of the reply is ":"
    Integer(i64),
    /// For Bulk Strings the first byte of the reply is "$"
    Bulk(String),
    /// For Bulk <binary> Strings the first byte of the reply is "$"
    BufBulk(Vec<u8>),
    /// For Arrays the first byte of the reply is "*"
    Array(Vec<Value>),
}

value.is_null() -> bool

value.is_error() -> bool

value.encode() -> Vec<u8>

value.to_encoded_string() -> io::Result<String>

value.to_beautify_string() -> String

encode

fn encode(value: &Value) -> Vec<u8>

fn encode_slice(array: &[&str]) -> Vec<u8>

Decoder

Decoder.new(reader: BufReader<R>) -> Self

Decoder.with_buf_bulk(reader: BufReader<R>) -> Self

decoder.decode() -> Result<Value>

No runtime deps