emit/err.rs
1/*!
2Utilities for working with the `err` well-known property.
3*/
4
5use std::error::Error;
6
7/**
8Convert an error implementing `AsRef<dyn Error + 'static>` into an [`Error`].
9
10This method can be used to accept types like `anyhow::Error` when using the `err` property.
11*/
12pub fn as_ref<'a>(err: &'a impl AsRef<dyn Error + 'static>) -> &'a (dyn Error + 'static) {
13 err.as_ref()
14}