{"id":33918630,"url":"https://github.com/wafkse/fack","last_synced_at":"2026-04-04T13:02:08.579Z","repository":{"id":322667603,"uuid":"1089832783","full_name":"wafkse/fack","owner":"wafkse","description":"Declarative error handling library with no_std support and composable code generation","archived":false,"fork":false,"pushed_at":"2025-11-05T17:25:47.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"trunk","last_synced_at":"2025-12-13T14:36:07.988Z","etag":null,"topics":["derive"],"latest_commit_sha":null,"homepage":"https://docs.rs/fack","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wafkse.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-04T21:53:40.000Z","updated_at":"2025-11-05T17:27:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"e1ccc08c-53d4-4259-800c-96a7ce4b22e0","html_url":"https://github.com/wafkse/fack","commit_stats":null,"previous_names":["wafkse/fack"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/wafkse/fack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wafkse%2Ffack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wafkse%2Ffack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wafkse%2Ffack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wafkse%2Ffack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wafkse","download_url":"https://codeload.github.com/wafkse/fack/tar.gz/refs/heads/trunk","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wafkse%2Ffack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31400460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["derive"],"created_at":"2025-12-12T08:28:13.784Z","updated_at":"2026-04-04T13:02:08.574Z","avatar_url":"https://github.com/wafkse.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fack\n\n[![CI](https://github.com/wafkse/fack/actions/workflows/ci.yml/badge.svg?branch=trunk)](https://github.com/wafkse/fack/actions/workflows/ci.yml)\n\nError handling derive macro for Rust. `no_std` compatible, doesn't allocate.\n\n```rust,no_run\nuse fack::prelude::*;\n\n#[derive(Error, Debug)]\n#[error(\"file not found: {path}\")]\nstruct FileError {\n    path: String,\n}\n```\n\n## Installation\n\n```toml\n[dependencies]\nfack = \"0.1.2\"\n```\n\n## What's different from thiserror?\n\n- Actually runs in `no_std` environments - uses `::core` by default, zero heap allocations at runtime\n- Control inlining with `#[error(inline(...))]` - matters for hot paths and code size\n- `fack-codegen` is a standalone library - use it in your own macros or build scripts\n- Preserves source spans properly for better IDE integration\n\nIf you're writing embedded code or care about allocation-free error handling, this might be useful.\n\n## Examples\n\nBasic struct:\n\n```rust,no_run\nuse fack::prelude::*;\n\n#[derive(Error, Debug)]\n#[error(\"database error: {msg}\")]\nstruct DbError {\n    msg: String,\n}\n```\n\nError chaining:\n\n```rust,no_run\nuse fack::prelude::*;\n\n#[derive(Error, Debug)]\n#[error(\"request failed\")]\n#[error(source(io))]\nstruct RequestError {\n    io: std::io::Error,\n    url: String,\n}\n```\n\nEnums with variants:\n\n```rust,no_run\nuse fack::prelude::*;\n\n#[derive(Error, Debug)]\nenum ParseError {\n    #[error(\"invalid syntax at line {line}\")]\n    Syntax { line: usize },\n\n    #[error(\"unexpected end of file\")]\n    Eof,\n\n    #[error(transparent(0))]\n    Io(std::io::Error),\n}\n```\n\nAuto-conversion with `from`:\n\n```rust,no_run\nuse fack::prelude::*;\n\n#[derive(Error, Debug)]\nenum AppError {\n    #[error(\"io error\")]\n    #[error(from)]\n    Io(std::io::Error),\n\n    #[error(\"parse error\")]\n    #[error(from)]\n    Parse(std::num::ParseIntError),\n}\n\n// Now you can use ? with these error types\nfn example() -\u003e Result\u003c(), AppError\u003e {\n    let _file = std::fs::read(\"file.txt\")?;  // converts io::Error\n    let _num: i32 = \"123\".parse()?;          // converts ParseIntError\n    Ok(())\n}\n```\n\n## Attributes\n\n**Format strings** - `#[error(\"message\")]`\n\nUse `{field}` for named fields, `{_0}` for tuple fields. Standard format specifiers work.\n\n```rust,no_run\n#[derive(Error, Debug)]\n#[error(\"value {value} out of range {min}..{max}\")]\nstruct RangeError { value: i32, min: i32, max: i32 }\n\n#[derive(Error, Debug)]\n#[error(\"invalid input: {_0:?}\")]\nstruct InputError(String);\n```\n\n**Source** - `#[error(source(field))]`\n\nMark which field contains the underlying error. Enables error chain traversal.\n\n```rust,no_run\n#[derive(Error, Debug)]\n#[error(\"operation failed\")]\n#[error(source(cause))]\nstruct OpError {\n    cause: std::io::Error,\n}\n```\n\n**Transparent** - `#[error(transparent(field))]`\n\nForward display and source to an inner error. Useful for wrapper types.\n\n```rust,no_run\n#[derive(Error, Debug)]\n#[error(transparent(0))]\nstruct Wrapper(std::io::Error);\n```\n\n**From** - `#[error(from)]`\n\nGenerate `From\u003cT\u003e` impl for the error type. Requires exactly one field.\n\n```rust,no_run\n#[derive(Error, Debug)]\n#[error(\"wrapped io error\")]\n#[error(from)]\nstruct IoWrapper(std::io::Error);\n```\n\n**Inline** - `#[error(inline(strategy))]`\n\nControl inlining of generated methods. Options: `neutral` (default), `always`, `never`.\n\n```rust,no_run\n#[derive(Error, Debug)]\n#[error(inline(always))]  // force inline for hot paths\n#[error(\"fast error\")]\nstruct HotPathError { code: u32 }\n```\n\n**Import** - `#[error(import(path))]`\n\nOverride the default `::core` import. Use `::std` if you need std-specific features.\n\n```rust,no_run\n#[derive(Error, Debug)]\n#[error(import(::std))]\n#[error(\"std error\")]\nstruct StdError { msg: String }\n```\n\n## Documentation\n\nFull docs at [docs.rs/fack](https://docs.rs/fack).\n\n## Workspace structure\n\nThis repo has four crates:\n\n- `fack` - Main crate, re-exports everything\n- `fack-core` - Error trait definition\n- `fack-macro` - Procedural macro implementation\n- `fack-codegen` - Code generation engine\n\nThe `fack-codegen` crate is deliberately not a proc-macro crate. You can depend on it in regular code to build custom error macros or generate errors at build time.\n\n## License\n\nGPL-3.0\n\nCopyright (C) 2025 W. Frakchi\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nSee [LICENSE.md](LICENSE.md) for the full text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwafkse%2Ffack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwafkse%2Ffack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwafkse%2Ffack/lists"}