{"id":22923721,"url":"https://github.com/mithril-security/anyhow-xargo-sgx","last_synced_at":"2025-07-15T11:44:17.946Z","repository":{"id":95695362,"uuid":"406821317","full_name":"mithril-security/anyhow-xargo-sgx","owner":"mithril-security","description":"Port anyhow to Teaclave Rust SGX SDK and Xargo","archived":false,"fork":false,"pushed_at":"2022-03-28T14:02:48.000Z","size":749,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"target-sgx","last_synced_at":"2025-04-01T14:49:56.146Z","etag":null,"topics":[],"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/mithril-security.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-09-15T15:20:55.000Z","updated_at":"2022-02-14T21:03:16.000Z","dependencies_parsed_at":"2023-04-13T09:52:37.707Z","dependency_job_id":null,"html_url":"https://github.com/mithril-security/anyhow-xargo-sgx","commit_stats":null,"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"purl":"pkg:github/mithril-security/anyhow-xargo-sgx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mithril-security%2Fanyhow-xargo-sgx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mithril-security%2Fanyhow-xargo-sgx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mithril-security%2Fanyhow-xargo-sgx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mithril-security%2Fanyhow-xargo-sgx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mithril-security","download_url":"https://codeload.github.com/mithril-security/anyhow-xargo-sgx/tar.gz/refs/heads/target-sgx","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mithril-security%2Fanyhow-xargo-sgx/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265433095,"owners_count":23764222,"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-12-14T08:16:26.474Z","updated_at":"2025-07-15T11:44:17.936Z","avatar_url":"https://github.com/mithril-security.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Anyhow\u0026ensp;¯\\\\\\_(°ペ)\\_/¯\n==========================\n\n[\u003cimg alt=\"github\" src=\"https://img.shields.io/badge/github-dtolnay/anyhow-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e](https://github.com/dtolnay/anyhow)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/anyhow.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/anyhow)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-anyhow-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logoColor=white\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K\" height=\"20\"\u003e](https://docs.rs/anyhow)\n[\u003cimg alt=\"build status\" src=\"https://img.shields.io/github/workflow/status/dtolnay/anyhow/CI/master?style=for-the-badge\" height=\"20\"\u003e](https://github.com/dtolnay/anyhow/actions?query=branch%3Amaster)\n\nThis library provides [`anyhow::Error`][Error], a trait object based error type\nfor easy idiomatic error handling in Rust applications.\n\n[Error]: https://docs.rs/anyhow/1.0/anyhow/struct.Error.html\n\n```toml\n[dependencies]\nanyhow = \"1.0\"\n```\n\n*Compiler support: requires rustc 1.38+*\n\n\u003cbr\u003e\n\n## Details\n\n- Use `Result\u003cT, anyhow::Error\u003e`, or equivalently `anyhow::Result\u003cT\u003e`, as the\n  return type of any fallible function.\n\n  Within the function, use `?` to easily propagate any error that implements the\n  `std::error::Error` trait.\n\n  ```rust\n  use anyhow::Result;\n\n  fn get_cluster_info() -\u003e Result\u003cClusterMap\u003e {\n      let config = std::fs::read_to_string(\"cluster.json\")?;\n      let map: ClusterMap = serde_json::from_str(\u0026config)?;\n      Ok(map)\n  }\n  ```\n\n- Attach context to help the person troubleshooting the error understand where\n  things went wrong. A low-level error like \"No such file or directory\" can be\n  annoying to debug without more context about what higher level step the\n  application was in the middle of.\n\n  ```rust\n  use anyhow::{Context, Result};\n\n  fn main() -\u003e Result\u003c()\u003e {\n      ...\n      it.detach().context(\"Failed to detach the important thing\")?;\n\n      let content = std::fs::read(path)\n          .with_context(|| format!(\"Failed to read instrs from {}\", path))?;\n      ...\n  }\n  ```\n\n  ```console\n  Error: Failed to read instrs from ./path/to/instrs.json\n\n  Caused by:\n      No such file or directory (os error 2)\n  ```\n\n- Downcasting is supported and can be by value, by shared reference, or by\n  mutable reference as needed.\n\n  ```rust\n  // If the error was caused by redaction, then return a\n  // tombstone instead of the content.\n  match root_cause.downcast_ref::\u003cDataStoreError\u003e() {\n      Some(DataStoreError::Censored(_)) =\u003e Ok(Poll::Ready(REDACTED_CONTENT)),\n      None =\u003e Err(error),\n  }\n  ```\n\n- If using the nightly channel, or stable with `features = [\"backtrace\"]`, a\n  backtrace is captured and printed with the error if the underlying error type\n  does not already provide its own. In order to see backtraces, they must be\n  enabled through the environment variables described in [`std::backtrace`]:\n\n  - If you want panics and errors to both have backtraces, set\n    `RUST_BACKTRACE=1`;\n  - If you want only errors to have backtraces, set `RUST_LIB_BACKTRACE=1`;\n  - If you want only panics to have backtraces, set `RUST_BACKTRACE=1` and\n    `RUST_LIB_BACKTRACE=0`.\n\n  The tracking issue for this feature is [rust-lang/rust#53487].\n\n  [`std::backtrace`]: https://doc.rust-lang.org/std/backtrace/index.html#environment-variables\n  [rust-lang/rust#53487]: https://github.com/rust-lang/rust/issues/53487\n\n- Anyhow works with any error type that has an impl of `std::error::Error`,\n  including ones defined in your crate. We do not bundle a `derive(Error)` macro\n  but you can write the impls yourself or use a standalone macro like\n  [thiserror].\n\n  ```rust\n  use thiserror::Error;\n\n  #[derive(Error, Debug)]\n  pub enum FormatError {\n      #[error(\"Invalid header (expected {expected:?}, got {found:?})\")]\n      InvalidHeader {\n          expected: String,\n          found: String,\n      },\n      #[error(\"Missing attribute: {0}\")]\n      MissingAttribute(String),\n  }\n  ```\n\n- One-off error messages can be constructed using the `anyhow!` macro, which\n  supports string interpolation and produces an `anyhow::Error`.\n\n  ```rust\n  return Err(anyhow!(\"Missing attribute: {}\", missing));\n  ```\n\n  A `bail!` macro is provided as a shorthand for the same early return.\n\n  ```rust\n  bail!(\"Missing attribute: {}\", missing);\n  ```\n\n\u003cbr\u003e\n\n## No-std support\n\nIn no_std mode, the same API is almost all available and works the same way. To\ndepend on Anyhow in no_std mode, disable our default enabled \"std\" feature in\nCargo.toml. A global allocator is required.\n\n```toml\n[dependencies]\nanyhow = { version = \"1.0\", default-features = false }\n```\n\nSince the `?`-based error conversions would normally rely on the\n`std::error::Error` trait which is only available through std, no_std mode will\nrequire an explicit `.map_err(Error::msg)` when working with a non-Anyhow error\ntype inside a function that returns Anyhow's error type.\n\n\u003cbr\u003e\n\n## Comparison to failure\n\nThe `anyhow::Error` type works something like `failure::Error`, but unlike\nfailure ours is built around the standard library's `std::error::Error` trait\nrather than a separate trait `failure::Fail`. The standard library has adopted\nthe necessary improvements for this to be possible as part of [RFC 2504].\n\n[RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md\n\n\u003cbr\u003e\n\n## Comparison to thiserror\n\nUse Anyhow if you don't care what error type your functions return, you just\nwant it to be easy. This is common in application code. Use [thiserror] if you\nare a library that wants to design your own dedicated error type(s) so that on\nfailures the caller gets exactly the information that you choose.\n\n[thiserror]: https://github.com/dtolnay/thiserror\n\n\u003cbr\u003e\n\n#### License\n\n\u003csup\u003e\nLicensed under either of \u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version\n2.0\u003c/a\u003e or \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e at your option.\n\u003c/sup\u003e\n\n\u003cbr\u003e\n\n\u003csub\u003e\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this crate by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmithril-security%2Fanyhow-xargo-sgx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmithril-security%2Fanyhow-xargo-sgx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmithril-security%2Fanyhow-xargo-sgx/lists"}