/rust/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.75/src/context.rs
Line | Count | Source |
1 | | use crate::error::ContextError; |
2 | | use crate::{Context, Error, StdError}; |
3 | | use core::convert::Infallible; |
4 | | use core::fmt::{self, Debug, Display, Write}; |
5 | | |
6 | | #[cfg(backtrace)] |
7 | | use std::error::Request; |
8 | | |
9 | | mod ext { |
10 | | use super::*; |
11 | | |
12 | | pub trait StdError { |
13 | | fn ext_context<C>(self, context: C) -> Error |
14 | | where |
15 | | C: Display + Send + Sync + 'static; |
16 | | } |
17 | | |
18 | | #[cfg(feature = "std")] |
19 | | impl<E> StdError for E |
20 | | where |
21 | | E: std::error::Error + Send + Sync + 'static, |
22 | | { |
23 | 0 | fn ext_context<C>(self, context: C) -> Error |
24 | 0 | where |
25 | 0 | C: Display + Send + Sync + 'static, |
26 | | { |
27 | 0 | let backtrace = backtrace_if_absent!(&self); |
28 | 0 | Error::from_context(context, self, backtrace) |
29 | 0 | } Unexecuted instantiation: <_ as anyhow::context::ext::StdError>::ext_context::<_> Unexecuted instantiation: <hound::Error as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <command_fds::FdMappingCollision as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <serde_json::error::Error as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <std::io::error::Error as anyhow::context::ext::StdError>::ext_context::<alloc::string::String> Unexecuted instantiation: <protobuf::text_format::parse::ParseError as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <audio_processor::processor::Error as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <core::num::error::TryFromIntError as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <nix::errno::consts::Errno as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <audio_processor::processor::Error as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <std::io::error::Error as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <std::sync::mpsc::RecvError as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <std::io::error::Error as anyhow::context::ext::StdError>::ext_context::<&str> |
30 | | } |
31 | | |
32 | | impl StdError for Error { |
33 | 0 | fn ext_context<C>(self, context: C) -> Error |
34 | 0 | where |
35 | 0 | C: Display + Send + Sync + 'static, |
36 | | { |
37 | 0 | self.context(context) |
38 | 0 | } Unexecuted instantiation: <anyhow::Error as anyhow::context::ext::StdError>::ext_context::<_> Unexecuted instantiation: <anyhow::Error as anyhow::context::ext::StdError>::ext_context::<alloc::string::String> Unexecuted instantiation: <anyhow::Error as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <anyhow::Error as anyhow::context::ext::StdError>::ext_context::<alloc::string::String> Unexecuted instantiation: <anyhow::Error as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <anyhow::Error as anyhow::context::ext::StdError>::ext_context::<&str> Unexecuted instantiation: <anyhow::Error as anyhow::context::ext::StdError>::ext_context::<&str> |
39 | | } |
40 | | } |
41 | | |
42 | | impl<T, E> Context<T, E> for Result<T, E> |
43 | | where |
44 | | E: ext::StdError + Send + Sync + 'static, |
45 | | { |
46 | 0 | fn context<C>(self, context: C) -> Result<T, Error> |
47 | 0 | where |
48 | 0 | C: Display + Send + Sync + 'static, |
49 | | { |
50 | | // Not using map_err to save 2 useless frames off the captured backtrace |
51 | | // in ext_context. |
52 | 0 | match self { |
53 | 0 | Ok(ok) => Ok(ok), |
54 | 0 | Err(error) => Err(error.ext_context(context)), |
55 | | } |
56 | 0 | } Unexecuted instantiation: <core::result::Result<_, _> as anyhow::Context<_, _>>::context::<_> Unexecuted instantiation: <core::result::Result<alloc::vec::Vec<usize>, core::num::error::TryFromIntError> as anyhow::Context<alloc::vec::Vec<usize>, core::num::error::TryFromIntError>>::context::<&str> Unexecuted instantiation: <core::result::Result<alloc::boxed::Box<dyn audio_processor::processors::peer::managed::WorkerHandle>, anyhow::Error> as anyhow::Context<alloc::boxed::Box<dyn audio_processor::processors::peer::managed::WorkerHandle>, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::buffer::MultiSlice<f32>, audio_processor::processor::Error> as anyhow::Context<audio_processor::buffer::MultiSlice<f32>, audio_processor::processor::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<hound::write::WavWriter<std::io::buffered::bufwriter::BufWriter<std::fs::File>>, hound::Error> as anyhow::Context<hound::write::WavWriter<std::io::buffered::bufwriter::BufWriter<std::fs::File>>, hound::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<core::ops::control_flow::ControlFlow<()>, anyhow::Error> as anyhow::Context<core::ops::control_flow::ControlFlow<()>, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<nix::sys::socket::RecvMsg<()>, nix::errno::consts::Errno> as anyhow::Context<nix::sys::socket::RecvMsg<()>, nix::errno::consts::Errno>>::context::<&str> Unexecuted instantiation: <core::result::Result<alloc::string::String, serde_json::error::Error> as anyhow::Context<alloc::string::String, serde_json::error::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::shape::Format, serde_json::error::Error> as anyhow::Context<audio_processor::shape::Format, serde_json::error::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::config::Processor, anyhow::Error> as anyhow::Context<audio_processor::config::Processor, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::pipeline::Pipeline, anyhow::Error> as anyhow::Context<audio_processor::pipeline::Pipeline, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<std::path::PathBuf, anyhow::Error> as anyhow::Context<std::path::PathBuf, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::processors::speex::SpeexResampler, audio_processor::processor::Error> as anyhow::Context<audio_processor::processors::speex::SpeexResampler, audio_processor::processor::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::proto::cdcfg::Processor, protobuf::text_format::parse::ParseError> as anyhow::Context<audio_processor::proto::cdcfg::Processor, protobuf::text_format::parse::ParseError>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::processors::peer::host::BlockingSeqPacketProcessor, anyhow::Error> as anyhow::Context<audio_processor::processors::peer::host::BlockingSeqPacketProcessor, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::processors::peer::worker::Worker, anyhow::Error> as anyhow::Context<audio_processor::processors::peer::worker::Worker, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::processors::peer::managed::ManagedBlockingSeqPacketProcessor, anyhow::Error> as anyhow::Context<audio_processor::processors::peer::managed::ManagedBlockingSeqPacketProcessor, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::processors::peer::messages::Init, serde_json::error::Error> as anyhow::Context<audio_processor::processors::peer::messages::Init, serde_json::error::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::processors::plugin::dynamic::DynamicPluginProcessor, audio_processor::processor::Error> as anyhow::Context<audio_processor::processors::plugin::dynamic::DynamicPluginProcessor, audio_processor::processor::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<&mut std::process::Command, command_fds::FdMappingCollision> as anyhow::Context<&mut std::process::Command, command_fds::FdMappingCollision>>::context::<&str> Unexecuted instantiation: <core::result::Result<(audio_processor::processors::peer::messages::ResponseOp, &mut [u8]), anyhow::Error> as anyhow::Context<(audio_processor::processors::peer::messages::ResponseOp, &mut [u8]), anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<(audio_processor::processors::peer::messages::RequestOp, usize), anyhow::Error> as anyhow::Context<(audio_processor::processors::peer::messages::RequestOp, usize), anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<(std::os::fd::owned::OwnedFd, std::os::fd::owned::OwnedFd), nix::errno::consts::Errno> as anyhow::Context<(std::os::fd::owned::OwnedFd, std::os::fd::owned::OwnedFd), nix::errno::consts::Errno>>::context::<&str> Unexecuted instantiation: <core::result::Result<usize, core::num::error::TryFromIntError> as anyhow::Context<usize, core::num::error::TryFromIntError>>::context::<&str> Unexecuted instantiation: <core::result::Result<usize, nix::errno::consts::Errno> as anyhow::Context<usize, nix::errno::consts::Errno>>::context::<&str> Unexecuted instantiation: <core::result::Result<u32, core::num::error::TryFromIntError> as anyhow::Context<u32, core::num::error::TryFromIntError>>::context::<&str> Unexecuted instantiation: <core::result::Result<u16, core::num::error::TryFromIntError> as anyhow::Context<u16, core::num::error::TryFromIntError>>::context::<&str> Unexecuted instantiation: <core::result::Result<(), anyhow::Error> as anyhow::Context<(), anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<(), nix::errno::consts::Errno> as anyhow::Context<(), nix::errno::consts::Errno>>::context::<&str> Unexecuted instantiation: <core::result::Result<cras_ini::utf8cstring::Utf8CString, anyhow::Error> as anyhow::Context<cras_ini::utf8cstring::Utf8CString, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<core::result::Result<audio_processor::buffer::MultiBuffer<f32>, audio_processor::processor::Error>, std::sync::mpsc::RecvError> as anyhow::Context<core::result::Result<audio_processor::buffer::MultiBuffer<f32>, audio_processor::processor::Error>, std::sync::mpsc::RecvError>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::config::Processor, anyhow::Error> as anyhow::Context<audio_processor::config::Processor, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::pipeline::Pipeline, anyhow::Error> as anyhow::Context<audio_processor::pipeline::Pipeline, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<audio_processor::processors::plugin::processor::PluginProcessor, audio_processor::processor::Error> as anyhow::Context<audio_processor::processors::plugin::processor::PluginProcessor, audio_processor::processor::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<(), std::io::error::Error> as anyhow::Context<(), std::io::error::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<std::collections::hash::set::HashSet<alloc::string::String>, anyhow::Error> as anyhow::Context<std::collections::hash::set::HashSet<alloc::string::String>, anyhow::Error>>::context::<&str> Unexecuted instantiation: <core::result::Result<alloc::string::String, std::io::error::Error> as anyhow::Context<alloc::string::String, std::io::error::Error>>::context::<&str> |
57 | | |
58 | 0 | fn with_context<C, F>(self, context: F) -> Result<T, Error> |
59 | 0 | where |
60 | 0 | C: Display + Send + Sync + 'static, |
61 | 0 | F: FnOnce() -> C, |
62 | | { |
63 | 0 | match self { |
64 | 0 | Ok(ok) => Ok(ok), |
65 | 0 | Err(error) => Err(error.ext_context(context())), |
66 | | } |
67 | 0 | } Unexecuted instantiation: <core::result::Result<_, _> as anyhow::Context<_, _>>::with_context::<_, _> Unexecuted instantiation: <core::result::Result<alloc::string::String, std::io::error::Error> as anyhow::Context<alloc::string::String, std::io::error::Error>>::with_context::<alloc::string::String, audio_processor::cdcfg::parse::{closure#0}>Unexecuted instantiation: <core::result::Result<audio_processor::config::Processor, anyhow::Error> as anyhow::Context<audio_processor::config::Processor, anyhow::Error>>::with_context::<alloc::string::String, audio_processor::cdcfg::resolve::{closure#0}::{closure#0}>Unexecuted instantiation: <core::result::Result<std::process::Child, std::io::error::Error> as anyhow::Context<std::process::Child, std::io::error::Error>>::with_context::<alloc::string::String, <audio_processor::processors::peer::managed::AudioWorkerSubprocessFactory as audio_processor::processors::peer::managed::WorkerFactory>::create::{closure#0}>Unexecuted instantiation: <core::result::Result<u32, core::num::error::TryFromIntError> as anyhow::Context<u32, core::num::error::TryFromIntError>>::with_context::<&str, <audio_processor::processors::speex::SpeexResampler>::new::{closure#0}>Unexecuted instantiation: <core::result::Result<u32, core::num::error::TryFromIntError> as anyhow::Context<u32, core::num::error::TryFromIntError>>::with_context::<&str, <audio_processor::processors::speex::SpeexResampler>::new::{closure#2}>Unexecuted instantiation: <core::result::Result<u32, core::num::error::TryFromIntError> as anyhow::Context<u32, core::num::error::TryFromIntError>>::with_context::<&str, <audio_processor::processors::speex::SpeexResampler>::new::{closure#1}>Unexecuted instantiation: <core::result::Result<(), anyhow::Error> as anyhow::Context<(), anyhow::Error>>::with_context::<alloc::string::String, <audio_processor::config::PipelineBuilder>::add::{closure#0}>Unexecuted instantiation: <core::result::Result<cras_ini::utf8cstring::Utf8CString, anyhow::Error> as anyhow::Context<cras_ini::utf8cstring::Utf8CString, anyhow::Error>>::with_context::<alloc::string::String, cras_ini::parse_string<alloc::string::String>::{closure#2}> |
68 | | } |
69 | | |
70 | | /// ``` |
71 | | /// # type T = (); |
72 | | /// # |
73 | | /// use anyhow::{Context, Result}; |
74 | | /// |
75 | | /// fn maybe_get() -> Option<T> { |
76 | | /// # const IGNORE: &str = stringify! { |
77 | | /// ... |
78 | | /// # }; |
79 | | /// # unimplemented!() |
80 | | /// } |
81 | | /// |
82 | | /// fn demo() -> Result<()> { |
83 | | /// let t = maybe_get().context("there is no T")?; |
84 | | /// # const IGNORE: &str = stringify! { |
85 | | /// ... |
86 | | /// # }; |
87 | | /// # unimplemented!() |
88 | | /// } |
89 | | /// ``` |
90 | | impl<T> Context<T, Infallible> for Option<T> { |
91 | 6 | fn context<C>(self, context: C) -> Result<T, Error> |
92 | 6 | where |
93 | 6 | C: Display + Send + Sync + 'static, |
94 | | { |
95 | | // Not using ok_or_else to save 2 useless frames off the captured |
96 | | // backtrace. |
97 | 6 | match self { |
98 | 0 | Some(ok) => Ok(ok), |
99 | 6 | None => Err(Error::from_display(context, backtrace!())), |
100 | | } |
101 | 6 | } Unexecuted instantiation: <core::option::Option<_> as anyhow::Context<_, core::convert::Infallible>>::context::<_> Unexecuted instantiation: <core::option::Option<&std::ffi::os_str::OsStr> as anyhow::Context<&std::ffi::os_str::OsStr, core::convert::Infallible>>::context::<&str> Unexecuted instantiation: <core::option::Option<&audio_processor::proto::cdcfg::dlc_plugin::Path_oneof> as anyhow::Context<&audio_processor::proto::cdcfg::dlc_plugin::Path_oneof, core::convert::Infallible>>::context::<&str> Unexecuted instantiation: <core::option::Option<&audio_processor::proto::cdcfg::dlc_plugin::Dlc_id_oneof> as anyhow::Context<&audio_processor::proto::cdcfg::dlc_plugin::Dlc_id_oneof, core::convert::Infallible>>::context::<&str> Unexecuted instantiation: <core::option::Option<&audio_processor::proto::cdcfg::dlc_plugin::Constructor_oneof> as anyhow::Context<&audio_processor::proto::cdcfg::dlc_plugin::Constructor_oneof, core::convert::Infallible>>::context::<&str> Unexecuted instantiation: <core::option::Option<&audio_processor::proto::cdcfg::plugin::Path_oneof> as anyhow::Context<&audio_processor::proto::cdcfg::plugin::Path_oneof, core::convert::Infallible>>::context::<&str> Unexecuted instantiation: <core::option::Option<&audio_processor::proto::cdcfg::plugin::Constructor_oneof> as anyhow::Context<&audio_processor::proto::cdcfg::plugin::Constructor_oneof, core::convert::Infallible>>::context::<&str> Unexecuted instantiation: <core::option::Option<&str> as anyhow::Context<&str, core::convert::Infallible>>::context::<&str> Unexecuted instantiation: <core::option::Option<usize> as anyhow::Context<usize, core::convert::Infallible>>::context::<&str> Unexecuted instantiation: <core::option::Option<std::path::PathBuf> as anyhow::Context<std::path::PathBuf, core::convert::Infallible>>::context::<&str> <core::option::Option<&indexmap::map::IndexMap<cras_ini::utf8cstring::Utf8CString, cras_ini::utf8cstring::Utf8CString>> as anyhow::Context<&indexmap::map::IndexMap<cras_ini::utf8cstring::Utf8CString, cras_ini::utf8cstring::Utf8CString>, core::convert::Infallible>>::context::<&str> Line | Count | Source | 91 | 6 | fn context<C>(self, context: C) -> Result<T, Error> | 92 | 6 | where | 93 | 6 | C: Display + Send + Sync + 'static, | 94 | | { | 95 | | // Not using ok_or_else to save 2 useless frames off the captured | 96 | | // backtrace. | 97 | 6 | match self { | 98 | 0 | Some(ok) => Ok(ok), | 99 | 6 | None => Err(Error::from_display(context, backtrace!())), | 100 | | } | 101 | 6 | } |
Unexecuted instantiation: <core::option::Option<&cras_ini::utf8cstring::Utf8CString> as anyhow::Context<&cras_ini::utf8cstring::Utf8CString, core::convert::Infallible>>::context::<&str> |
102 | | |
103 | 0 | fn with_context<C, F>(self, context: F) -> Result<T, Error> |
104 | 0 | where |
105 | 0 | C: Display + Send + Sync + 'static, |
106 | 0 | F: FnOnce() -> C, |
107 | | { |
108 | 0 | match self { |
109 | 0 | Some(ok) => Ok(ok), |
110 | 0 | None => Err(Error::from_display(context(), backtrace!())), |
111 | | } |
112 | 0 | } Unexecuted instantiation: <core::option::Option<_> as anyhow::Context<_, core::convert::Infallible>>::with_context::<_, _> Unexecuted instantiation: <core::option::Option<&alloc::string::String> as anyhow::Context<&alloc::string::String, core::convert::Infallible>>::with_context::<alloc::string::String, audio_processor::cdcfg::get_const_or_var_str::{closure#0}>Unexecuted instantiation: <core::option::Option<alloc::string::String> as anyhow::Context<alloc::string::String, core::convert::Infallible>>::with_context::<alloc::string::String, cras_ini::parse_string<alloc::string::String>::{closure#1}> |
113 | | } |
114 | | |
115 | | impl<C, E> Debug for ContextError<C, E> |
116 | | where |
117 | | C: Display, |
118 | | E: Debug, |
119 | | { |
120 | 0 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
121 | 0 | f.debug_struct("Error") |
122 | 0 | .field("context", &Quoted(&self.context)) |
123 | 0 | .field("source", &self.error) |
124 | 0 | .finish() |
125 | 0 | } Unexecuted instantiation: <anyhow::error::ContextError<_, _> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, anyhow::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, std::io::error::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, command_fds::FdMappingCollision> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, hound::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, serde_json::error::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, audio_processor::processor::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, core::num::error::TryFromIntError> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, nix::errno::consts::Errno> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, protobuf::text_format::parse::ParseError> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, anyhow::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, audio_processor::processor::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, std::io::error::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, std::sync::mpsc::RecvError> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, std::io::error::Error> as core::fmt::Debug>::fmt |
126 | | } |
127 | | |
128 | | impl<C, E> Display for ContextError<C, E> |
129 | | where |
130 | | C: Display, |
131 | | { |
132 | 0 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
133 | 0 | Display::fmt(&self.context, f) |
134 | 0 | } Unexecuted instantiation: <anyhow::error::ContextError<_, _> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, anyhow::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, std::io::error::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, command_fds::FdMappingCollision> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, hound::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, serde_json::error::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, audio_processor::processor::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, core::num::error::TryFromIntError> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, nix::errno::consts::Errno> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, protobuf::text_format::parse::ParseError> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, anyhow::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, audio_processor::processor::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, std::io::error::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, std::sync::mpsc::RecvError> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::fmt::Display>::fmt Unexecuted instantiation: <anyhow::error::ContextError<&str, std::io::error::Error> as core::fmt::Display>::fmt |
135 | | } |
136 | | |
137 | | impl<C, E> StdError for ContextError<C, E> |
138 | | where |
139 | | C: Display, |
140 | | E: StdError + 'static, |
141 | | { |
142 | 0 | fn source(&self) -> Option<&(dyn StdError + 'static)> { |
143 | 0 | Some(&self.error) |
144 | 0 | } Unexecuted instantiation: <anyhow::error::ContextError<_, _> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, std::io::error::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, command_fds::FdMappingCollision> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, hound::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, serde_json::error::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, audio_processor::processor::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, core::num::error::TryFromIntError> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, nix::errno::consts::Errno> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, protobuf::text_format::parse::ParseError> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, audio_processor::processor::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, std::io::error::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, std::sync::mpsc::RecvError> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, std::io::error::Error> as core::error::Error>::source |
145 | | |
146 | | #[cfg(backtrace)] |
147 | 0 | fn provide<'a>(&'a self, request: &mut Request<'a>) { |
148 | 0 | StdError::provide(&self.error, request); |
149 | 0 | } Unexecuted instantiation: <anyhow::error::ContextError<_, _> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, std::io::error::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, command_fds::FdMappingCollision> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, hound::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, serde_json::error::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, audio_processor::processor::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, core::num::error::TryFromIntError> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, nix::errno::consts::Errno> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, protobuf::text_format::parse::ParseError> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, audio_processor::processor::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, std::io::error::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, std::sync::mpsc::RecvError> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, std::io::error::Error> as core::error::Error>::provide |
150 | | } |
151 | | |
152 | | impl<C> StdError for ContextError<C, Error> |
153 | | where |
154 | | C: Display, |
155 | | { |
156 | 0 | fn source(&self) -> Option<&(dyn StdError + 'static)> { |
157 | 0 | Some(unsafe { crate::ErrorImpl::error(self.error.inner.by_ref()) }) |
158 | 0 | } Unexecuted instantiation: <anyhow::error::ContextError<_, anyhow::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, anyhow::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, anyhow::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::error::Error>::source Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::error::Error>::source |
159 | | |
160 | | #[cfg(backtrace)] |
161 | 0 | fn provide<'a>(&'a self, request: &mut Request<'a>) { |
162 | 0 | Error::provide(&self.error, request); |
163 | 0 | } Unexecuted instantiation: <anyhow::error::ContextError<_, anyhow::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, anyhow::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<alloc::string::String, anyhow::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::error::Error>::provide Unexecuted instantiation: <anyhow::error::ContextError<&str, anyhow::Error> as core::error::Error>::provide |
164 | | } |
165 | | |
166 | | struct Quoted<C>(C); |
167 | | |
168 | | impl<C> Debug for Quoted<C> |
169 | | where |
170 | | C: Display, |
171 | | { |
172 | 0 | fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
173 | 0 | formatter.write_char('"')?; |
174 | 0 | Quoted(&mut *formatter).write_fmt(format_args!("{}", self.0))?; |
175 | 0 | formatter.write_char('"')?; |
176 | 0 | Ok(()) |
177 | 0 | } Unexecuted instantiation: <anyhow::context::Quoted<_> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::context::Quoted<&alloc::string::String> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::context::Quoted<&&str> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::context::Quoted<&alloc::string::String> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::context::Quoted<&&str> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::context::Quoted<&&str> as core::fmt::Debug>::fmt Unexecuted instantiation: <anyhow::context::Quoted<&&str> as core::fmt::Debug>::fmt |
178 | | } |
179 | | |
180 | | impl Write for Quoted<&mut fmt::Formatter<'_>> { |
181 | 0 | fn write_str(&mut self, s: &str) -> fmt::Result { |
182 | 0 | Display::fmt(&s.escape_debug(), self.0) |
183 | 0 | } |
184 | | } |
185 | | |
186 | | pub(crate) mod private { |
187 | | use super::*; |
188 | | |
189 | | pub trait Sealed {} |
190 | | |
191 | | impl<T, E> Sealed for Result<T, E> where E: ext::StdError {} |
192 | | impl<T> Sealed for Option<T> {} |
193 | | } |