pub struct Error { /* private fields */ }Implementations§
source§impl Error
impl Error
sourcepub fn new(message: impl Into<SharedString>) -> Self
pub fn new(message: impl Into<SharedString>) -> Self
通过错误消息创建一个新的实例.
sourcepub fn with_source(
message: impl Into<SharedString>,
source: impl Into<Error>
) -> Self
pub fn with_source( message: impl Into<SharedString>, source: impl Into<Error> ) -> Self
通过错误消息和错误源创建新的实例
sourcepub fn context(self, message: impl Into<SharedString>) -> Self
pub fn context(self, message: impl Into<SharedString>) -> Self
通过额外的上下文错误消息,创建错误实例
sourcepub fn root_source(&self) -> Option<&Error>
pub fn root_source(&self) -> Option<&Error>
返回 slef 的顶层错误源
最顶层的错误源是通过 sources() 返回的迭代器的最后一个.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more