{"id":15295000,"url":"https://github.com/znx3p0/srpc","last_synced_at":"2025-10-06T02:10:53.436Z","repository":{"id":57668398,"uuid":"442583822","full_name":"znx3p0/srpc","owner":"znx3p0","description":"Simple RPC system based on top of Canary","archived":false,"fork":false,"pushed_at":"2022-01-25T03:28:20.000Z","size":26,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-02T14:42:34.096Z","etag":null,"topics":["async","distributed-computing","distributed-systems","rpc","rpc-framework","rpc-library","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/znx3p0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-28T21:05:26.000Z","updated_at":"2023-11-27T18:07:47.000Z","dependencies_parsed_at":"2022-08-27T03:24:51.273Z","dependency_job_id":null,"html_url":"https://github.com/znx3p0/srpc","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/znx3p0/srpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znx3p0%2Fsrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znx3p0%2Fsrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znx3p0%2Fsrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znx3p0%2Fsrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/znx3p0","download_url":"https://codeload.github.com/znx3p0/srpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znx3p0%2Fsrpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278437950,"owners_count":25986760,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["async","distributed-computing","distributed-systems","rpc","rpc-framework","rpc-library","rust"],"created_at":"2024-09-30T17:08:15.963Z","updated_at":"2025-10-06T02:10:53.409Z","avatar_url":"https://github.com/znx3p0.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SRPC\n\nSRPC is a simple RPC system built on top of [Canary](https://github.com/znx3p0/canary),\ndesigned to be as ergonomic and zero-cost as possible.\n\nA simple example of an SRPC service\n```rust\n#[srpc::rpc] // other options include rpc(mutex), rpc(none)\n#[derive(Default)]\nstruct DistributedList\u003cT\u003e {\n    list: Vec\u003cT\u003e\n}\n\n#[srpc::rpc]\nimpl\u003cT: Clone\u003e DistributedList\u003cT\u003e {\n    async fn push(\u0026mut self, value: T) {\n        self.list.push(value);\n    }\n    async fn get(\u0026self, index: usize) -\u003e Option\u003cT\u003e {\n        self.list.get(index).and_then(|val| Some(val.clone()))\n    }\n    async fn remove(\u0026mut self, index: usize) -\u003e T {\n        self.list.remove(index)\n    }\n}\n```\n\n```rust\n// database\nasync fn main() -\u003e Result\u003c()\u003e {\n    GLOBAL_ROUTE.add_service_at::\u003cDistributedList\u003ci32\u003e\u003e(\"list\", Arc::new(RwLock::new(Default::default())))?;\n    let addr = \"tcp@127.0.0.1:8080\".parse::\u003cAddr\u003e()?;\n    // listen in the following address\n    addr.bind().await?;\n    std::future::pending().await\n}\n\n// peer\nasync fn main() -\u003e Result\u003c()\u003e {\n    let addr = \"list://tcp@127.0.0.1:8080\".parse::\u003cServiceAddr\u003e()?;\n    let connection = addr.connect().await?;\n    let mut db = connection.client::\u003cDistributedList\u003ci32\u003e\u003e();\n    db.push(1).await?;\n    db.push(5).await?;\n    db.push(6).await?;\n\n    let value = db.get(1).await?;\n    println!(\"{:?}\", value); // index 1 == 5\n    Ok(())\n}\n```\n\nSRPC also allows method attributes for flexibility.\nThe current attributes you can apply to methods are:\n- `#[consume]`\n- `#[server_consume]`\n- `#[client_consume]`\n- `#[server]`\n- `#[client]`\n- `#[manual]`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznx3p0%2Fsrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fznx3p0%2Fsrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznx3p0%2Fsrpc/lists"}