[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5615":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},5615,"anyhow","dtolnay\u002Fanyhow","dtolnay","Flexible concrete Error type built on std::error::Error","",null,"Rust",6554,212,22,35,0,12,39,5,37.99,"Apache License 2.0",false,"master",[],"2026-06-12 02:01:12","Anyhow&ensp;¯\\\\\\_(°ペ)\\_\u002F¯\n==========================\n\n[\u003Cimg alt=\"github\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fgithub-dtolnay\u002Fanyhow-8da0cb?style=for-the-badge&labelColor=555555&logo=github\" height=\"20\">](https:\u002F\u002Fgithub.com\u002Fdtolnay\u002Fanyhow)\n[\u003Cimg alt=\"crates.io\" src=\"https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Fanyhow.svg?style=for-the-badge&color=fc8d62&logo=rust\" height=\"20\">](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fanyhow)\n[\u003Cimg alt=\"docs.rs\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdocs.rs-anyhow-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs\" height=\"20\">](https:\u002F\u002Fdocs.rs\u002Fanyhow)\n[\u003Cimg alt=\"build status\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Fdtolnay\u002Fanyhow\u002Fci.yml?branch=master&style=for-the-badge\" height=\"20\">](https:\u002F\u002Fgithub.com\u002Fdtolnay\u002Fanyhow\u002Factions?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:\u002F\u002Fdocs.rs\u002Fanyhow\u002F1.0\u002Fanyhow\u002Fstruct.Error.html\n\n```toml\n[dependencies]\nanyhow = \"1.0\"\n```\n\n\u003Cbr>\n\n## Details\n\n- Use `Result\u003CT, anyhow::Error>`, or equivalently `anyhow::Result\u003CT>`, 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() -> Result\u003CClusterMap> {\n      let config = std::fs::read_to_string(\"cluster.json\")?;\n      let map: ClusterMap = serde_json::from_str(&config)?;\n      Ok(map)\n  }\n  ```\n\n  [`std::error::Error`]: https:\u002F\u002Fdoc.rust-lang.org\u002Fstd\u002Ferror\u002Ftrait.Error.html\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() -> Result\u003C()> {\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 .\u002Fpath\u002Fto\u002Finstrs.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  \u002F\u002F If the error was caused by redaction, then return a\n  \u002F\u002F tombstone instead of the content.\n  match root_cause.downcast_ref::\u003CDataStoreError>() {\n      Some(DataStoreError::Censored(_)) => Ok(Poll::Ready(REDACTED_CONTENT)),\n      None => Err(error),\n  }\n  ```\n\n- If using Rust &ge; 1.65, a backtrace is captured and printed with the error if\n  the underlying error type does not already provide its own. In order to see\n  backtraces, they must be enabled through the environment variables described\n  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  [`std::backtrace`]: https:\u002F\u002Fdoc.rust-lang.org\u002Fstd\u002Fbacktrace\u002Findex.html#environment-variables\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>\n\n## No-std support\n\nIn no_std mode, almost all of the same API is available and works the same way.\nTo depend 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\nWith versions of Rust older than 1.81, no_std mode may require an additional\n`.map_err(Error::msg)` when working with a non-Anyhow error type inside a\nfunction that returns Anyhow's error type, as the trait that `?`-based error\nconversions are defined by is only available in std in those old versions.\n\n\u003Cbr>\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:\u002F\u002Fgithub.com\u002Frust-lang\u002Frfcs\u002Fblob\u002Fmaster\u002Ftext\u002F2504-fix-error.md\n\n\u003Cbr>\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:\u002F\u002Fgithub.com\u002Fdtolnay\u002Fthiserror\n\n\u003Cbr>\n\n#### License\n\n\u003Csup>\nLicensed under either of \u003Ca href=\"LICENSE-APACHE\">Apache License, Version\n2.0\u003C\u002Fa> or \u003Ca href=\"LICENSE-MIT\">MIT license\u003C\u002Fa> at your option.\n\u003C\u002Fsup>\n\n\u003Cbr>\n\n\u003Csub>\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\u002Fsub>\n","dtolnay\u002Fanyhow 是一个基于 Rust 标准库 `std::error::Error` 的灵活错误处理库。它提供了 `anyhow::Error` 类型，简化了 Rust 应用中的错误处理流程，支持通过 `?` 操作符轻松传播错误，并允许在错误上附加上下文信息以增强调试时的可读性。此外，该库还支持错误类型的向下转换（by value, by shared reference, or by mutable reference），并能够为没有自带回溯信息的错误类型捕获和打印回溯堆栈。适用于需要简洁且强大错误处理机制的各种 Rust 项目中，特别是在那些对错误诊断和用户友好性有较高要求的应用场景下。",2,"2026-06-11 03:04:21","top_language"]