{"id":25826769,"url":"https://github.com/watchdg/rust-resp-protocol","last_synced_at":"2026-06-11T11:31:21.027Z","repository":{"id":57660573,"uuid":"441562178","full_name":"WatchDG/rust-resp-protocol","owner":"WatchDG","description":"REdis Serialization Protocol","archived":false,"fork":false,"pushed_at":"2022-01-02T10:51:19.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-30T20:28:55.577Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WatchDG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-24T22:05:18.000Z","updated_at":"2022-01-02T10:51:22.000Z","dependencies_parsed_at":"2022-09-10T09:22:27.422Z","dependency_job_id":null,"html_url":"https://github.com/WatchDG/rust-resp-protocol","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WatchDG%2Frust-resp-protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WatchDG%2Frust-resp-protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WatchDG%2Frust-resp-protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WatchDG%2Frust-resp-protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WatchDG","download_url":"https://codeload.github.com/WatchDG/rust-resp-protocol/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241176617,"owners_count":19922732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-28T15:44:49.633Z","updated_at":"2026-06-11T11:31:20.398Z","avatar_url":"https://github.com/WatchDG.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-resp-protocol\r\n\r\nREdis Serialization Protocol\r\n\r\n## Install\r\n\r\nadd `resp-protocol` to `Cargo.toml`\r\n``` toml\r\n[dependencies]\r\nresp-protocol = \"0.0.10\"\r\n```\r\n\r\n## Usage\r\n\r\n``` rust\r\nuse resp_protocol;\r\n```\r\n\r\n## Types\r\n* Simple string\r\n* Error\r\n* Integer\r\n* Bulk string\r\n* Array\r\n\r\n### Simple string\r\n\r\n#### Examples\r\n\r\n##### Value\r\n\r\n``` text\r\n\"+OK\\r\\n\"\r\n```\r\n\r\n##### Build\r\n\r\n``` rust\r\nuse resp_protocol::SimpleString;\r\n\r\nlet simple_string: SimpleString = SimpleString::new(b\"OK\");\r\n```\r\n\r\n##### Parse\r\n\r\n``` rust\r\nuse resp_protocol::SimpleString;\r\n\r\nlet string: \u0026str = \"+OK\\r\\n\";\r\nlet simple_string: SimpleString = SimpleString::parse(string.as_bytes(), \u0026mut 0, \u0026string.len()).unwrap();\r\n```\r\n\r\n### Error\r\n\r\n#### Examples\r\n\r\n##### Value\r\n\r\n``` text\r\n\"-ERROR\\r\\n\"\r\n```\r\n\r\n##### Build\r\n\r\n``` rust\r\nuse resp_protocol::Error;\r\n\r\nlet error: Error = Error::new(b\"ERROR\");\r\n```\r\n\r\n##### Parse\r\n\r\n``` rust\r\nuse resp_protocol::Error;\r\n\r\nlet string: \u0026str = \"-ERROR\\r\\n\";\r\nlet error: Error = Error::parse(string.as_bytes(), \u0026mut 0, \u0026string.len()).unwrap();\r\n```\r\n\r\n### Integer\r\n\r\n#### Examples\r\n\r\n##### Value\r\n\r\n``` text\r\n\":100\\r\\n\"\r\n```\r\n\r\n##### Build\r\n\r\n``` rust\r\nuse resp_protocol::Integer;\r\n\r\nlet integer: Integer = Integer::new(-100i64);\r\n```\r\n\r\n##### Parse\r\n\r\n``` rust\r\nuse resp_protocol::Integer;\r\n\r\nlet string: \u0026str = \":-100\\r\\n\";\r\nlet integer: Integer = Integer::parse(string.as_bytes(), \u0026mut 0, \u0026string.len()).unwrap();\r\n```\r\n\r\n### Bulk string\r\n\r\n#### Examples\r\n\r\n##### Value\r\n\r\n``` text\r\n\"$6\\r\\nfoobar\\r\\n\"\r\n```\r\n\r\n##### Build\r\n\r\n``` rust\r\nuse resp_protocol::BulkString;\r\n\r\nlet bulk_string: BulkString = BulkString::new(b\"foobar\");\r\n```\r\n\r\n##### Parse\r\n\r\n``` rust\r\nuse resp_protocol::BulkString;\r\n\r\nlet string: \u0026str = \"$6\\r\\nfoobar\\r\\n\";\r\nlet bulk_string: BulkString = BulkString::parse(string.as_bytes(), \u0026mut 0, \u0026string.len()).unwrap();\r\n```\r\n\r\n### Array\r\n\r\n#### Examples\r\n\r\n##### Value\r\n\r\n``` text\r\n\"*0\\r\\n\"                            // empty array\r\n\"*2\\r\\n$3\\r\\nfoo\\r\\n$3\\r\\nbar\\r\\n\"  // bulk strings array\r\n\"*2\\r\\n:1\\r\\n$6\\r\\nfoobar\\r\\n\"      // mixed types array\r\n```\r\n\r\n##### Build\r\n\r\n``` rust\r\nuse resp_procotol::{Array, ArrayBuilder, RespType, Integer, BulkString};\r\n\r\nlet mut array_builder: ArrayBuilder = ArrayBuilder::new();\r\narray_builder.insert(RespType::Integer(Integer::new(100)));\r\narray_builder.insert(RespType::BulkString(BulkString::new(b\"foobar\")));\r\n\r\nlet array: Array = array_builder.build();\r\nprintln!(\"{:?}\", array); // Array(b\"*2\\r\\n:100\\r\\n$6\\r\\nfoobar\\r\\n\")\r\n```\r\n\r\n##### Parse\r\n\r\n``` rust\r\nuse resp_protocol::Array;\r\n\r\nlet string = \"*2\\r\\n$3\\r\\nfoo\\r\\n$3\\r\\nbar\\r\\n\";\r\nlet array = Array::parse(string.as_bytes(), \u0026mut 0, \u0026string.len()).unwrap();\r\nprintln!(\"{:?}\", array); // Array(b\"*2\\r\\n$3\\r\\nfoo\\r\\n$3\\r\\nbar\\r\\n\")\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatchdg%2Frust-resp-protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwatchdg%2Frust-resp-protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatchdg%2Frust-resp-protocol/lists"}