{"id":23416234,"url":"https://github.com/bluk/bt_bencode","last_synced_at":"2025-04-12T08:53:01.933Z","repository":{"id":37482036,"uuid":"237718883","full_name":"bluk/bt_bencode","owner":"bluk","description":"Helps with Bencode encoding/decoding.","archived":false,"fork":false,"pushed_at":"2025-03-16T19:40:00.000Z","size":329,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"trunk","last_synced_at":"2025-04-12T08:52:56.683Z","etag":null,"topics":["bencode","bencode-parser","bencoder","bittorrent","rust","serde","serde-support"],"latest_commit_sha":null,"homepage":"https://docs.rs/bt_bencode/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bluk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-02T04:37:44.000Z","updated_at":"2025-04-04T08:11:53.000Z","dependencies_parsed_at":"2024-05-16T05:09:06.003Z","dependency_job_id":"3e9bad29-e26d-4f2f-92eb-9e18c68778dc","html_url":"https://github.com/bluk/bt_bencode","commit_stats":{"total_commits":76,"total_committers":2,"mean_commits":38.0,"dds":"0.013157894736842146","last_synced_commit":"6fef7989032a5c54579cf408e46e710f78053f7d"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluk%2Fbt_bencode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluk%2Fbt_bencode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluk%2Fbt_bencode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluk%2Fbt_bencode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluk","download_url":"https://codeload.github.com/bluk/bt_bencode/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248543882,"owners_count":21121838,"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":["bencode","bencode-parser","bencoder","bittorrent","rust","serde","serde-support"],"created_at":"2024-12-22T22:14:05.533Z","updated_at":"2025-04-12T08:53:01.910Z","avatar_url":"https://github.com/bluk.png","language":"Rust","readme":"# BtBencode\n\nBtBencode is a library which can help with [Bencode][wikipedia_bencode]\nencoding/decoding.  Bencode is primarily used in [BitTorrent][bep_0003] related\napplications.\n\nIt uses the [Serde][serde] library to serialize and deserialize Bencode data.\nIt is similar to [Serde JSON][serde_json] in terms of functionality and\nimplementation.\n\n* [Latest API Documentation][docs_rs_bt_bencode]\n\n## Examples\n\nAn example serializing a standard Rust collection type and then deserializing\ninto a custom type:\n\n```rust\nuse std::collections::BTreeMap;\nuse serde_derive::Deserialize;\n\nlet mut dict: BTreeMap\u003cString, String\u003e = BTreeMap::new();\ndict.insert(String::from(\"url\"), String::from(\"https://example.com/\"));\n\nlet serialized_bytes = bt_bencode::to_vec(\u0026dict)?;\n\n#[derive(Deserialize)]\nstruct Info\u003c'a\u003e {\n    url: \u0026'a str,\n}\n\nlet info: Info = bt_bencode::from_slice(\u0026serialized_bytes)?;\nassert_eq!(info.url, \"https://example.com/\");\n```\n\nAn example deserializing from a slice of bytes into a general `Value`\nrepresentation and then from the `Value` instance into a more strongly typed\ndata structure.\n\n```rust\nuse serde_derive::{Serialize, Deserialize};\n\nuse bt_bencode::Value;\n\n#[derive(Serialize, Deserialize)]\nstruct Info {\n    t: String,\n    url: String,\n}\n\nlet serialized_bytes = bt_bencode::to_vec(\u0026Info {\n    t: String::from(\"query\"),\n    url: String::from(\"https://example.com/\"),\n})?;\n\nlet value: Value = bt_bencode::from_slice(\u0026serialized_bytes)?;\nassert_eq!(value[\"t\"].as_str().unwrap(), \"query\");\nassert_eq!(\n    value.get(\"url\").and_then(|url| url.as_str()).unwrap(),\n    \"https://example.com/\"\n);\n\nlet info: Info = bt_bencode::from_value(value)?;\nassert_eq!(info.t, \"query\");\nassert_eq!(info.url, \"https://example.com/\");\n```\n\n## Installation\n\n```sh\ncargo add bt_bencode\n```\n\nBy default, the `std` feature is enabled.\n\n### Alloc only\n\nIf the host environment has an allocator but does not have access to the Rust\n`std` library:\n\n```sh\ncargo add --no-default-features --features alloc bt_bencode\n```\n\n## License\n\nLicensed under either of [Apache License, Version 2.0][LICENSE_APACHE] or [MIT\nLicense][LICENSE_MIT] at your option.\n\n### Contributions\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n[LICENSE_APACHE]: LICENSE-APACHE\n[LICENSE_MIT]: LICENSE-MIT\n[wikipedia_bencode]: https://en.wikipedia.org/wiki/Bencode\n[bep_0003]: http://www.bittorrent.org/beps/bep_0003.html\n[serde]: https://serde.rs\n[serde_json]: https://github.com/serde-rs/json\n[docs_rs_bt_bencode]: https://docs.rs/bt_bencode/latest/bt_bencode/","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluk%2Fbt_bencode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluk%2Fbt_bencode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluk%2Fbt_bencode/lists"}