Files
archy/core/target/debug/deps/libthiserror-b5ff04312b141a9f.rmeta
T

52 lines
22 KiB
Plaintext
Raw Normal View History

2026-01-24 22:59:20 +00:00
rust
yW#rustc 1.93.0 (254b59607 2026-01-19)Áõ…·fÊ ¦%g--c48c539199cbc88bÁ³VOÐêùÿ²?ÑL¼§Ì±-a7a40eb546f9e2b0Áá\ƒ¦è3$|]åŒ[IÚ tæ-14b12edc9f8cd90bÁë&Gf·Ã ¬ëñq:¤»b-bb76018b1173caf6Áà 9m Ù„«ÐÒþá•cB;-030c5b0bba47cc8fÁrustc_std_workspace_coreÁÛ¹þÓ7>H%¸ÚÉ­-4b81d37a5530864dÁüÃùs<Uß7VyóHr#QÏ-c66cc7807550ce25Á miniz_oxideÁõFÖˆÚ™ª‹"ÞXzLVª-62cbc7af83058505Áadler2Á—wÉD‘嵯|6¨%Œ
+-2f171dd2394b4b62Á hashbrownÁ,ïcV¼¨ø¢:Ê\'È߈-9571ba9e0f6c7a90Árustc_std_workspace_allocÁ%¥Èxµù·¼5Ä3Bœ-aac566ad65903fa4Á
std_detectÁMmáýZ^9õ Îà§e˜÷e-2edb296e590136d8Árustc_demangleÁ@¼§VÉNb˜æ¨fHÌ+V3-53b132e4a2fa6e26Ácfg_ifÁfÝv.Å"ÒÜuPp¹ˆ¶-f76b385d7d4d7f3eÁ addr2lineÁÕú-WiúQVÓ¬
µT§5-fe25100bd73e48e4ÁgimliÁ¹xLáÇí÷‘o±Ñ8£Å-265ba9e6e4f70b3fÁobjectÁÔ³ÝzÓÿ¶ò°öM›¼òü`-9ae0d1f8ea52a318ÁmemchrÁRÎ÷׎™te~QÓ¿ØC\Ò-0bff3c8e8f4e489eÁ  –©HtGNÏ·ˆ!á-d69228d077d46f36Áthiserror_implÁ•>ùÕ ãdø ;,iV½N.-153d8d97a97ffd5fÁprovideÁ<ãDerror_generic_member_accessÁÜÁDAThiserrorProvideÁ„‹GܾFaserrorÁ
AsDynErrorÁ'aÁ as_dyn_errorÁ    ˜ 
 
˜  ˜  ˜  ˜ SealedÁ     " displayÁ$$$$$$ AsDisplayÁ* *š*
as_displayÁ$. ..š. $3 3š3 $7 7š7 $Œ
$<$$ __privateÁAA





.
<
*; Ï  Ï¨â  Ï¨â  Ï¿±¨â  ß
ù
¾* 8 *é,é,Ýê,innerÁÄ*Êèÿp6Ã *ä+ä+Þå+ÄÄ*Šáj¦*Eu ; 
;±;ï
ÏÏÏÏÏÏ Ï"Ï.
3é,7ä+<
>é,?ä+T*;$Aýç6ÈžGüš [![github]](https://github.com/dtolnay/thiserror)&ensp;[![crates-io]](https://crates.io/crates/thiserror)&ensp;[![docs-rs]](https://docs.rs/thiserror)ÁËüŸjg [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=githubÁüŠnk [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rustÁüùmj [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rsÁçË <br>ÁôËüøNK This library provides a convenient derive macro for the standard library'sÁüÇ  [`std::error::Error`] trait.ÁèËüìOL [`std::error::Error`]: https://doc.rust-lang.org/std/error/trait.Error.htmlÁ¼ËøÉË
# ExampleÁÛË ```rustÁ”ë # use std::io;ÁÌþ use thiserror::Error;Á˜ËÜœ #[derive(Error, Debug)]Áì¸ pub enum DataStoreError {ÁüÖ+( #[error("data store disconnected")]Áü‚&# Disconnect(#[from] io::Error),Áü©;8 #[error("the data for key `{0}` is not available")]ÁÔå Redaction(String),Áü€KH #[error("invalid header (expected {expected:?}, found {found:?})")]Á¼Ì InvalidHeader {Áìä expected: String,ÁÔ‚  found: String,ÁT  },Áü¨ ,) #[error("unknown data store error")]Á„Õ
Unknown,Á ```Áô Ëø
Ël…
# DetailsÁ
Ëü—
LI - Thiserror deliberately does not appear in your public API. You get theÁüä
OL same thing as if you had written an implementation of `std::error::Error`Áü´ NK by hand, and switching from handwritten impls to thiserror or vice versaÁüƒ  is not a breaking change.Á£ Ëü§ LI - Errors may be enums, structs with named fields, tuple structs, or unitÁ structs.Áƒ
Ëü‡
A> - A `Display` impl is generated for your error if you provide矃
OL `#[error("...")]` messages on the struct or each variant of your enum, asÁü™! shown above in the example.Á»Ëü¿OL The messages support a shorthand for interpolating fields from the error.ÁËü“DA - `#[error("{var}")]`&ensp;⟶&ensp;`write!("{}", self.var)`ÁüØ@= - `#[error("{0}")]`&ensp;⟶&ensp;`write!("{}", self.0)`Áü™HE - `#[error("{var:?}")]`&ensp;⟶&ensp;`write!("{:?}", self.var)`ÁüâDA - `#[error("{0:?}")]`&ensp;⟶&ensp;`write!("{:?}", self.0)`Á§Ëü«LI These shorthands can be used together with any additional format args,Áüø63 which may be arbitrary expressions. For example:Á¯Ë
```rustÁ´Á # use core::i32;ÁìØ # use thiserror::Error;Áìþ #[derive(Error, Debug)]Á´œ pub enum Error {Áü³PM #[error("invalid rdo_lookahead_frames {0} (expected < {})", i32::MAX)]Áü„  InvalidLookahead(u32),ÁL­ ```Á·Ëü»PM If one of the additional expression arguments needs to refer to a field ofÁüŒOL the struct or enum, then refer to named fields as `.var` and tuple fieldsÁ as `.0`.ÁëËÜ&ìý'<´'ü£+( # fn first_char(s: &String) -> char {ÁüÏ%" # s.chars().next().unwrap()Á # }Á<ÿ´'ć # #[derive(Debug)]Á¼  # struct Limits {Á´¸ # lo: usize,Á´Ï # hi: usize,Áˆ,´'ìøÃ'´–è'ü­QN #[error("first letter must be lowercase but was {:?}", first_char(.0))]Áäÿ WrongCase(String),Áüœfc #[error("invalid index {idx}, expected at least {} and at most {}", .limits.lo, .limits.hi)]Áüƒ52 OutOfBounds { idx: usize, limits: Limits },Áˆ)—)ËËüÏKH - A `From` impl is generated for each variant that contains a `#[from]`Á„›
attribute.Á¬Ëü°NK The variant using `#[from]` must not contain any other fields beyond theÁüÿHE source error (and possibly a backtrace &mdash; see below). UsuallyÁüÈMJ `#[from]` fields are unnamed, but `#[from]` is allowed on a named fieldÁT too.Á¡ËÜ&ü³'$ # use core::fmt::{self, Display};Á¤Û # use std::io;Áìð'´'¬– # mod globset {Áü¬.+ # #[derive(thiserror::Error, Debug)]ÁÜÛ # #[error("...")]Áì÷ # pub struct Error;ÁL•ˆ,´'ì§Ã'ÄÅ pub enum MyError {ÁüÞ  Io(#[from] io::Error),Áüÿ'$ Glob(#[from] globset::Error),Áˆ)´'ü· " # impl Display for MyError {ÁüÚ JG # fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {Áü¥!  # unimplemented!()ÁlÆ!
# }ÁLÔ!ˆ,LÞ!—)è!Ëüì!LI - The Error trait's `source()` method is implemented to return whicheverÁü¹"MJ field has a `#[source]` attribute or is named `source`, if any. This isÁü‡#NK for identifying the underlying lower level error that caused your error.ÁÖ#ËüÚ#PM The `#[from]` attribute always implies that the same field is `#[source]`,Áü«$85 so you don't ever need to specify both attributes.Áä$Ëüè$PM Any error type that implements `std::error::Error` or dereferences to `dynÁü¹%/, std::error::Error` will work as a source.Áé%Ëlí%Ü&üû%'µ3ì£&'<Á&´'ìÉ&Ã'Ôç& pub struct MyError {Á´‚' msg: String,Áü™':7 #[source] // optional if field name is `source`ÁüÔ'  source: anyhow::Error,Á<õ'ˆ)<ý'´'ü…("ã6ü¨(JŽ7üó( á7l”)‰8L¢)ˆ,L¬)—)¶)Ëüº)NK - The Error trait's `provide()` method is implemented to provide whicheverÁü‰*63 field has a type named `Backtrace`, if any, as aÁüÀ*IF `std::backtrace::Backtrace`. Using `Backtrace` in errors requires aÁüŠ+74 nightly compiler with Rust version 1.73 or newer.ÁÂ+ËlÆ+Ü&üÔ+)& # const IGNORE: &str = stringify! {Áüþ+$! use std::backtrace::Backtrace;Á£,Ëì§,Ã'ÔÅ,Å=´à,ç=ü÷,:7 backtrace: Backtrace, // automatically detectedÁ<²-ˆ)Tº- # };ÁLÅ-—)Ï-ËüÓ-HE - If a field is both a source (named `source`, or has `#[source]` orÁüœ.IF `#[from]` attribute) *and* is marked `#[backtrace]`, then the ErrorÁüæ.OL trait's `provide()` method is forwarded to the source's `provide` so thatÁü¶/KH both layers of the error share the same backtrace. The `#[backtrace]`Áü‚0LI attribute requires a nightly compiler with Rust version 1.73 or newer.ÁÏ0ËlÓ0Ü&üá0)Bì‹1Ã'Ä©1Ó5tÂ1 Io {ÁÔÑ1 #[backtrace]Áüì1  source: io::Error,Ád2 },Á<š2ˆ)T¢2îCL­2—)·2Ëü»2MJ - For variants that use `#[from]` and also contain a `Backtrace` field, aÁü‰385 backtrace is captured from within the `From` impl.ÁÂ3ËlÆ3Ü&üÔ3)Bìþ3Ã'Äœ4Ó5tµ4òG¬Ä4 #[from]ÁüÚ4 «Hüû4# backtrace: Backtrace,ÁdŸ5ÓH<¬5ˆ)T´5îCL¿5—)É5ËüÍ5KH - Errors may use `error(transparent)` to forward the source and DisplayÁü™6GD methods straight through to an underlying error without adding anÁüá6JG additional message. This would be appropriate for enums that need anÁô¬7 "anything else" variant.ÁË7ËLÏ7—)ìÙ7'<÷7´'ìÿ7Ã'Ä8Ó5t¶8 # /*ÁlÅ8
...ÁtÓ8 # */Áâ8Ëüæ8 #[error(transparent)]Áü†9XU Other(#[from] anyhow::Error), // source and Display delegate to anyhow::ErrorÁ<ß9ˆ)Lç9—)ñ9Ëüõ9C@ Another use case is hiding implementation details of an errorÁü¹:OL representation behind an opaque error type, so that the representation isÁü‰;=: able to evolve without breaking the crate's public API.ÁÇ;ËLË;—)ìÕ;'<ó;´'üû;GD // PublicError is public, but opaque and easy to keep compatible.ÁìÃ<Ã'Üá< #[error(transparent)]Áüý<0- pub struct PublicError(#[from] ErrorRepr);Á®=ËIJ= impl PublicError {ÁüË=B? // Accessors for anything we do want to expose publicly.Á<Ž>ˆ)>Ëüš>FC // Private and free to change across minor version of the crate.Áìá>Ã'´ÿ> enum ErrorRepr {Át?ØNl¥?îNt³?ƒO<Â?ˆ)LÊ?—)Ô?ËüØ?OL - See also the [`anyhow`] library for a convenient single error type to useÁÔ¨@ in application code.ÁÃ@ËüÇ@30 [`anyhow`]: https://github.com/dtolnay/anyhowÁ¡ÿ@ A µA8¹lƒA A7 https://docs.rs/thiserror/1.0.69Áü“A"üü@;$A/?È@///\¡D<¥D
UnwindSafeÁT¿±,-ϼ%Œ!üD ¡7 : A8°4;t5TN ªâüDU¿[4^·[#É[·[-É[$Yük,dnD D¿[ DÏ  {
¿[ $|ü›,
 
©âÍ
¤ÏÍ
Í
 ¯Í
  24
üÜ+E 

  ì
 Í
ü * ß