{"id":19321291,"url":"https://github.com/leshow/tokio-udp-framed","last_synced_at":"2025-10-15T10:23:27.791Z","repository":{"id":57670131,"uuid":"334776173","full_name":"leshow/tokio-udp-framed","owner":"leshow","description":"A modified UdpFramed from tokio-util that supports shared sockets","archived":false,"fork":false,"pushed_at":"2021-05-12T19:17:14.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-10T22:21:37.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/leshow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-31T23:06:02.000Z","updated_at":"2021-09-08T13:43:54.000Z","dependencies_parsed_at":"2022-09-26T20:40:23.697Z","dependency_job_id":null,"html_url":"https://github.com/leshow/tokio-udp-framed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leshow/tokio-udp-framed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leshow%2Ftokio-udp-framed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leshow%2Ftokio-udp-framed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leshow%2Ftokio-udp-framed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leshow%2Ftokio-udp-framed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leshow","download_url":"https://codeload.github.com/leshow/tokio-udp-framed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leshow%2Ftokio-udp-framed/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266139706,"owners_count":23882521,"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":"2024-11-10T01:36:28.757Z","updated_at":"2025-10-15T10:23:27.734Z","avatar_url":"https://github.com/leshow.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tokio-udp-framed (Changes merged into tokio-util!)\n\n**Update** Was able to merge code into `tokio-util` that provides the main functionality, taking a `Borrow\u003cUdpSocket\u003e`, without breaking the API (thanks Darksonn!). So this crate is effectively dead and you should use `tokio-util` ([link to pr](https://github.com/tokio-rs/tokio/pull/3451))\n\n---\n\nThis started from a copy of `UdpFramed` from `tokio-util` with a few modifications that provides a somewhat different API:\n\n- All `UdpFramed` types take a `Borrow\u003cUdpSocket\u003e` so you can pass an `Arc\u003cUdpSocket\u003e` or `\u0026UdpSocket`\n- There are `UpdFramedRecv` and `UdpFramedSend` types for specifically `send` and `recv` in `Sink`/`Stream`\n- Because of `Borrow\u003cUdpSocket\u003e` you can't use `get_mut` anymore\n\nThe main benefit can be easily explained in an example:\n\n```rust\nlet a_soc = Arc::new(UdpSocket::bind(\"127.0.0.1:0\").await?);\nlet b_soc = a_soc.clone();\n\nlet a_addr = a_soc.local_addr()?;\nlet b_addr = b_soc.local_addr()?;\n\nlet mut a = UdpFramed::new(a_soc, ByteCodec);\nlet mut b = UdpFramed::new(b_soc, LinesCodec::new());\n\nlet msg = b\"1\\r\\n2\\r\\n3\\r\\n\".to_vec();\na.send((\u0026msg, b_addr)).await?;\n\nlet msg = b\"4\\r\\n5\\r\\n6\\r\\n\".to_vec();\na.send((\u0026msg, b_addr)).await?;\n\nassert_eq!(b.next().await.unwrap().unwrap(), (\"1\".to_string(), a_addr));\nassert_eq!(b.next().await.unwrap().unwrap(), (\"2\".to_string(), a_addr));\nassert_eq!(b.next().await.unwrap().unwrap(), (\"3\".to_string(), a_addr));\n\nassert_eq!(b.next().await.unwrap().unwrap(), (\"4\".to_string(), a_addr));\nassert_eq!(b.next().await.unwrap().unwrap(), (\"5\".to_string(), a_addr));\nassert_eq!(b.next().await.unwrap().unwrap(), (\"6\".to_string(), a_addr));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleshow%2Ftokio-udp-framed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleshow%2Ftokio-udp-framed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleshow%2Ftokio-udp-framed/lists"}