{"id":16795204,"url":"https://github.com/abonander/ferrite","last_synced_at":"2025-07-28T10:38:05.097Z","repository":{"id":21912245,"uuid":"25236348","full_name":"abonander/ferrite","owner":"abonander","description":"Predecessor to Anterofit (https://github.com/abonander/anterofit)","archived":false,"fork":false,"pushed_at":"2014-10-17T08:29:48.000Z","size":200,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T00:02:39.408Z","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/abonander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-15T02:55:04.000Z","updated_at":"2018-05-02T08:49:14.000Z","dependencies_parsed_at":"2022-08-20T01:31:21.587Z","dependency_job_id":null,"html_url":"https://github.com/abonander/ferrite","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/abonander%2Fferrite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abonander%2Fferrite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abonander%2Fferrite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abonander%2Fferrite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abonander","download_url":"https://codeload.github.com/abonander/ferrite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317701,"owners_count":21083528,"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-10-13T09:15:41.248Z","updated_at":"2025-04-11T00:02:45.552Z","avatar_url":"https://github.com/abonander.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"ferrite\n=======\n\nA typesafe API wrapper generator for Rust, in the same vein as Retrofit for Java (https://square.github.io/retrofit/).\n\nCompared to Retrofit, ferrite generates the glue-code at compile-time; no runtime reflection necessary. Generated functions return informative errors on failure, and can be called just like any other Rust function.\n\nCurrently only a proof-of-concept, ferrite needs quite a bit more work to reach feature-parity with Retrofit,\nand even the underlying [`rest_client`](https://github.com/gtolle/rest_client) library that powers it.\n\n* ~~POST Requests~~\n* Miscellaneous REST verbs (PUT, DELETE, HEAD, etc.) (Easily implemented)\n* ~~URL Interpolation (e.g. replacing `{id}` in `/users/{id}/posts/` with a dynamic argument)~~\n* Multipart/file/binary uploads (using `Reader`)\n* Generation of methods (e.g. functions in an `impl` that take `\u0026self`) that can pass struct fields as parameters\n* Support for generics (necessary?)\n* Configurable parameter keys (necessary?)\n* Static/dynamic manipulation of headers (necessary?)\n* Usability/readability tweaks to syntax\n\nUsage\n-----\n\nAdd to your `Cargo.toml`:\n```\n[dependencies.ferrite]\ngit = \"https://github.com/cybergeek94/ferrite\"\n```\n\n```rust\nextern crate ferrite; // Not sure if needs #[phase(plugin)]\n// Ferrite's error type needs to be in-scope for the function signatures\nuse self::ferrite::APIError; \n    \n#[deriving(Decodable)]\nstruct Test {\n    hello: String,\n}\n    \n// Function will have the following generated signature:\n// fn hello_world() -\u003e Result\u003cTest, APIError\u003e (this is why the error type needs to be in-scope)\nget!(\"https://raw.githubusercontent.com/cybergeek94/ferrite/master/json/hello_world.json\":\n    fn hello_world() -\u003e Test)\n  \n// Vectors are automatically decoded!\nget!(\"https://raw.githubusercontent.com/cybergeek94/ferrite/master/json/hello_vec.json\": \n    fn hello_vec() -\u003e Vec\u003cTest\u003e)\n   \n// Wrap URL format parameters with {} \nget!(\"https://raw.githubusercontent.com/cybergeek94/ferrite/master/json/hello_{}.json\": \n    fn hello{val: \u0026str}() -\u003e Test)\n\n// POST requests now available!\npost!(\"https://raw.githubusercontent.com/cybergeek94/ferrite/master/json/hello_world.json\":\n        fn post_hello_world() -\u003e Test)\n\nfn main() {\n    let test = hello_world().unwrap();\n    assert!(test.hello.as_slice() == \"world\");\n    \n    let test = hello(\"world\").unwrap();\n    assert!(test.hello.as_slice() == \"world\"); \n    \n    let test_vec = hello_vec().unwrap();\n    let mut test_iter = test_vec.iter();\n    assert!(test_iter.next().unwrap().hello.as_slice() == \"world\");\n    assert!(test_iter.next().unwrap().hello.as_slice() == \"nation\");\n    assert!(test_iter.next().unwrap().hello.as_slice() == \"city\");\n    assert!(test_iter.next().unwrap().hello.as_slice() == \"person\");\n    assert!(test_iter.next().is_none());\n\n    let test = post_hello_world().unwrap();\n    assert!(test.hello.as_slice() == \"world\");\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabonander%2Fferrite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabonander%2Fferrite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabonander%2Fferrite/lists"}