{"id":16567403,"url":"https://github.com/bruxisma/outcome","last_synced_at":"2025-06-22T20:41:38.108Z","repository":{"id":37048048,"uuid":"387697216","full_name":"bruxisma/outcome","owner":"bruxisma","description":"An experiment in an augmented error handling type for Rust","archived":false,"fork":false,"pushed_at":"2025-04-14T22:48:07.000Z","size":527,"stargazers_count":39,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-14T23:32:43.653Z","etag":null,"topics":["crates-io","error-handling","error-reporting","eyre","miette","outcome","rust","rust-crate"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":false,"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/bruxisma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"bruxisma"}},"created_at":"2021-07-20T06:38:51.000Z","updated_at":"2025-04-14T22:48:09.000Z","dependencies_parsed_at":"2023-11-07T02:27:39.302Z","dependency_job_id":"c60b8efe-69c7-4aff-9a60-11beb05ab787","html_url":"https://github.com/bruxisma/outcome","commit_stats":{"total_commits":243,"total_committers":5,"mean_commits":48.6,"dds":"0.48559670781893005","last_synced_commit":"2881edd3805d144a2f73cf50d2a5e42a1da3ee0c"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruxisma%2Foutcome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruxisma%2Foutcome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruxisma%2Foutcome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruxisma%2Foutcome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bruxisma","download_url":"https://codeload.github.com/bruxisma/outcome/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250080492,"owners_count":21371516,"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":["crates-io","error-handling","error-reporting","eyre","miette","outcome","rust","rust-crate"],"created_at":"2024-10-11T21:06:30.170Z","updated_at":"2025-04-21T15:30:44.193Z","avatar_url":"https://github.com/bruxisma.png","language":"Rust","readme":"# Overview\n\n[![Audit][audit-badge-svg]][audit-badge-yml]\n[![Pull Request][pull-request-badge-svg]][pull-request-badge-yml]\n[![codecov][codecov-badge-svg]][codecov-badge-lnk]\n[![Documentation][documentation-badge-svg]][documentation-badge-lnk]\n\n[`Outcome\u003cS, M, F\u003e`][`Outcome`] is an augmentation of the [`Result`] type\nfound in the Rust standard library.\n\nIt is an enum with the variants\n - [`Success(S)`], representing success and containing a value\n - [`Mistake(M)`], representing an optionally *retryable error* and\n    containing a value\n - [`Failure(F)`], representing failure and containing a value.\n\n```rust\nenum Outcome\u003cS, M, F\u003e {\n  Success(S),\n  Mistake(M),\n  Failure(F),\n}\n```\n\n[`Outcome`] is an *augmentation* to [`Result`]. It adds a third state to\nthe \"success or failure\" dichotomy that [`Result\u003cT, E\u003e`][`Result`] models.\nThis third state is that of a *soft* or *retryable* error. A *retryable*\nerror is one where an operation might not have succeeded, either due to\nother operations (e.g., a disk read or write not completing),\nmisconfiguration (e.g., forgetting to set a specific flag before calling a\nfunction), or busy resources (e.g., attempting to lock an audio, video, or\ndatabase resource).\n\n```rust\nuse outcome::prelude::*;\n\n#[derive(Debug, PartialEq)]\nenum Version { V1, V2 }\n\n#[derive(Debug, PartialEq)]\nstruct EmptyInput;\n\nfn parse_version(header: \u0026[u8]) -\u003e Outcome\u003cVersion, EmptyInput, \u0026'static str\u003e {\n  match header.get(0) {\n    None =\u003e Mistake(EmptyInput),\n    Some(\u00261) =\u003e Success(Version::V1),\n    Some(\u00262) =\u003e Success(Version::V2),\n    Some(_) =\u003e Failure(\"invalid or unknown version\"),\n  }\n}\n\nlet version = parse_version(\u0026[]);\nassert_eq!(version, Mistake(EmptyInput));\n```\n\n# Usage\n\nAt this time, the name `outcome` is already taken on [crates.io]. As\n[crates.io] does not yet support namespaces or collections, we've had to\ntake a *unique* approach to still publish the crate. To do this, we've\ngenerated a `UUIDv5` string via python:\n\n```python\nfrom uuid import *\nprint(uuid5(uuid5(NAMESPACE_DNS, \"occult.work\"), \"outcome\"))\n```\n\nThis *should* generate the string `46f94afc-026f-5511-9d7e-7d1fd495fb5c`.\nThus the dependency in your `Cargo.toml` will look something like:\n\n```toml\n[dependencies]\noutcome-46f94afc-026f-5511-9d7e-7d1fd495fb5c = \"*\"\n```\n\nHowever, the exported library is still named `outcome`, so importing it is\ntreated the same:\n\n```rust\nuse outcome::prelude::*;\n```\n\nUsers can also work around this by using the `package` key in their\ndependency declaration:\n\n```toml\n[dependencies.outcome]\nversion = \"*\"\npackage = \"outcome-46f94afc-026f-5511-9d7e-7d1fd495fb5c\"\n```\n\nIs this solution friendly to users? No, but neither is the lack of\nnamespacing nor a squatting policy on [crates.io]. If/when this problem is\nresolved, this crate's documentation (and name!) will be changed and all\nversions will be yanked.\n\n[`Result`]: core::result::Result\n\n[`Outcome`]: crate::prelude::Outcome\n\n[`Success(S)`]: crate::prelude::Success\n[`Mistake(M)`]: crate::prelude::Mistake\n[`Failure(F)`]: crate::prelude::Failure\n\n[crates.io]: https://crates.io\n[`eyre`]: https://crates.io/crates/eyre\n\n[documentation-badge-svg]: https://img.shields.io/docsrs/outcome-46f94afc-026f-5511-9d7e-7d1fd495fb5c.svg?label=Documentation\n[documentation-badge-lnk]: https://docs.rs/outcome-46f94afc-026f-5511-9d7e-7d1fd495fb5c/latest/outcome/\n\n[pull-request-badge-svg]: https://github.com/bruxisma/outcome/actions/workflows/pull-request.yml/badge.svg\n[pull-request-badge-yml]: https://github.com/bruxisma/outcome/actions/workflows/pull-request.yml\n[codecov-badge-svg]: https://codecov.io/gh/bruxisma/outcome/branch/main/graph/badge.svg\n[codecov-badge-lnk]: https://codecov.io/gh/bruxisma/outcome\n[audit-badge-svg]: https://github.com/bruxisma/outcome/actions/workflows/audit.yml/badge.svg\n[audit-badge-yml]: https://github.com/bruxisma/outcome/actions/workflows/audit.yml\n","funding_links":["https://github.com/sponsors/bruxisma"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbruxisma%2Foutcome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbruxisma%2Foutcome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbruxisma%2Foutcome/lists"}