{"id":19962965,"url":"https://github.com/bastion-rs/fort","last_synced_at":"2025-05-03T22:31:28.687Z","repository":{"id":45954162,"uuid":"213076260","full_name":"bastion-rs/fort","owner":"bastion-rs","description":"Proc macro attributes for Bastion runtime.","archived":false,"fork":false,"pushed_at":"2021-11-24T21:31:59.000Z","size":38,"stargazers_count":49,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-19T11:17:21.676Z","etag":null,"topics":["bastion","fault-tolerance","fort","proc-macro","proc-macro-attributes","rust","rust-lang"],"latest_commit_sha":null,"homepage":null,"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/bastion-rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":"bastion","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-10-05T21:53:06.000Z","updated_at":"2025-03-29T20:32:20.000Z","dependencies_parsed_at":"2022-09-04T20:22:27.695Z","dependency_job_id":null,"html_url":"https://github.com/bastion-rs/fort","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastion-rs%2Ffort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastion-rs%2Ffort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastion-rs%2Ffort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastion-rs%2Ffort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bastion-rs","download_url":"https://codeload.github.com/bastion-rs/fort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251268267,"owners_count":21561985,"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":["bastion","fault-tolerance","fort","proc-macro","proc-macro-attributes","rust","rust-lang"],"created_at":"2024-11-13T02:13:55.383Z","updated_at":"2025-05-03T22:31:28.381Z","avatar_url":"https://github.com/bastion-rs.png","language":"Rust","funding_links":["https://opencollective.com/bastion"],"categories":[],"sub_categories":[],"readme":"# Fort\n\nFort is proc macro attribute crate for Bastion.\n\n## Usage\n```toml\n[dependencies]\nfort = \"0.4\"\nbastion = \"0.4\"\n```\n\nYou can directly use fort to load work onto the root supervisor with:\n```rust\n#[fort::root]\nasync fn main(_: BastionContext) -\u003e Result\u003c(), ()\u003e {\n    println!(\"Running in Bastion runtime!\");\n    Ok(())\n}\n```\n\nMake your program fault-tolerant with `fort`:\n```rust\n#[fort::root]\nasync fn main(_: BastionContext) -\u003e Result\u003c(), ()\u003e {\n    loop {\n        println!(\"Undying main!\");\n        panic!(\"Error\")\n    }\n}\n```\n\nYou want to spawn multiple process\n```rust\n#[fort::root(redundancy = 10)]\nasync fn main(_: BastionContext) -\u003e Result\u003c(), ()\u003e {\n    loop {\n        println!(\"Undying main!\");\n        panic!(\"Error\")\n    }\n}\n```\n\n# Example TCP Server\n\n```rust\nuse std::io::Write;\nuse std::net::TcpListener;\n\n#[fort::root]\nasync fn main(_: BastionContext) -\u003e Result\u003c(), ()\u003e {\n    let listener = TcpListener::bind(\"127.0.0.1:2278\").unwrap();\n    println!(\"TCP server started at 127.0.0.1:2278\");\n    for stream in listener.incoming() {\n        thread::spawn(|| {\n            let mut stream = stream.unwrap();\n            stream.write_all(b\"Hello World\\r\\n\").unwrap();\n            panic!(\"Fail in thread!\");\n        });\n        panic!(\"Fail in event loop\");\n    }\n\n    Ok(())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastion-rs%2Ffort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbastion-rs%2Ffort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastion-rs%2Ffort/lists"}