var searchIndex = {}; searchIndex["resp"] = {"doc":"RESP(REdis Serialization Protocol) Serialization for Rust.","items":[[3,"Decoder","resp","A streaming RESP decoder.",null,null],[4,"Value","","Represents a RESP value, see [Redis Protocol specification](http://redis.io/topics/protocol).",null,null],[13,"Null","","Null bulk reply, `$-1\\r\\n`",0,null],[13,"NullArray","","Null array reply, `*-1\\r\\n`",0,null],[13,"String","","For Simple Strings the first byte of the reply is "+".",0,null],[13,"Error","","For Errors the first byte of the reply is "-".",0,null],[13,"Integer","","For Integers the first byte of the reply is ":".",0,null],[13,"Bulk","","For Bulk Strings the first byte of the reply is "$".",0,null],[13,"BufBulk","","For Bulk <binary> Strings the first byte of the reply is "$".",0,null],[13,"Array","","For Arrays the first byte of the reply is "*".",0,null],[5,"encode","","Encode the value to RESP binary buffer.\n# Examples\n```\n# use self::resp::{Value, encode};\nlet val = Value::String("OK正".to_string());\nassert_eq!(encode(&val), vec![43, 79, 75, 230, 173, 163, 13, 10]);\n```",null,{"inputs":[{"name":"value"}],"output":{"name":"vec"}}],[5,"encode_slice","","Encode a array of slice string to RESP binary buffer. It is usefull for redis client to encode request command.\n# Examples\n```\n# use self::resp::encode_slice;\nlet array = ["SET", "a", "1"];\nassert_eq!(encode_slice(&array), "*3\\r\\n$3\\r\\nSET\\r\\n$1\\r\\na\\r\\n$1\\r\\n1\\r\\n".to_string().into_bytes());\n```",null,null],[11,"fmt","","",0,null],[11,"eq","","",0,null],[11,"ne","","",0,null],[11,"clone","","",0,null],[11,"is_null","","Returns `true` if the value is a `Null` or `NullArray`. Returns `false` otherwise.\n# Examples\n```\n# use self::resp::{Value};\nassert_eq!(Value::Null.is_null(), true);\nassert_eq!(Value::NullArray.is_null(), true);\nassert_eq!(Value::Integer(123).is_null(), false);\n```",0,null],[11,"is_error","","Returns `true` if the value is a `Error`. Returns `false` otherwise.\n# Examples\n```\n# use self::resp::{Value};\nassert_eq!(Value::Null.is_error(), false);\nassert_eq!(Value::Error("".to_string()).is_error(), true);\n```",0,null],[11,"encode","","Encode the value to RESP binary buffer.\n# Examples\n```\n# use self::resp::{Value};\nlet val = Value::String("OK正".to_string());\nassert_eq!(val.encode(), vec![43, 79, 75, 230, 173, 163, 13, 10]);\n```",0,null],[11,"to_encoded_string","","Encode the value to RESP string.\n# Examples\n```\n# use self::resp::{Value};\nlet val = Value::String("OK正".to_string());\nassert_eq!(val.to_encoded_string().unwrap(), "+OK正\\r\\n");\n```",0,null],[11,"to_beautify_string","","Encode the value to beautify formated string.\n# Examples\n```\n# use self::resp::{Value};\nassert_eq!(Value::Null.to_beautify_string(), "(Null)");\nassert_eq!(Value::NullArray.to_beautify_string(), "(Null Array)");\nassert_eq!(Value::String("OK".to_string()).to_beautify_string(), "OK");\nassert_eq!(Value::Error("Err".to_string()).to_beautify_string(), "(Error) Err");\nassert_eq!(Value::Integer(123).to_beautify_string(), "(Integer) 123");\nassert_eq!(Value::Bulk("Bulk String".to_string()).to_beautify_string(), "\\"Bulk String\\"");\nassert_eq!(Value::BufBulk(vec![]).to_beautify_string(), "(Empty Buffer)");\nassert_eq!(Value::BufBulk(vec![0, 100]).to_beautify_string(), "(Buffer) 00 64");\nassert_eq!(Value::Array(vec![]).to_beautify_string(), "(Empty Array)");\n```",0,null],[11,"fmt","","",1,null],[11,"new","","Creates a new decoder instance for decoding the RESP buffers.\n# Examples\n```\n# use self::resp::{Decoder, Value};\nlet mut decoder = Decoder::new();",1,{"inputs":[],"output":{"name":"self"}}],[11,"with_buf_bulk","","Creates a new decoder instance for decoding the RESP buffers. The instance will decode bulk value to buffer bulk.\n# Examples\n```\n# use self::resp::{Decoder, Value};\nlet mut decoder = Decoder::with_buf_bulk();",1,{"inputs":[],"output":{"name":"self"}}],[11,"feed","","Feeds buffers to decoder. The buffer may contain one more values, or be a part of value.\nYou can feed buffer at all times.\n# Examples\n```\n# use self::resp::{Decoder, Value};\nlet mut decoder = Decoder::new();\nassert_eq!(decoder.buffer_len(), 0);",1,null],[11,"read","","Reads a decoded value, will return `None` if no value decoded.",1,null],[11,"buffer_len","","Returns the buffer's length that wait for decoding. It usually is `0`. Non-zero means that decoder need more buffer.",1,null],[11,"result_len","","Returns decoded values count. The decoded values will be hold by decoder, until you read them.",1,null]],"paths":[[4,"Value"],[3,"Decoder"]]}; initSearch(searchIndex);