pub fn chained<E, S>(kind: Kind, error: E, source: S) -> Self
	where
		E: Into<Box<dyn error::Error + Send + Sync>>,
		S: Into<Box<dyn error::Error + Send + Sync>>,
	{
		Self {
			repr: Repr::Chained(Box::new(Chained {
				kind,
				error: error.into(),
				source: source.into(),
			})),
		}
	}
/// Creates a new error from a known kind of error as well as an arbitrary
/// error payload and keeps another payload as source error.
///
/// The `error` argument is an arbitrary payload which will be contained in
/// this `Error`. The `source` argument is an error, which will be returned
/// by [`Error::source`]
///
/// [`Error::source`]: std::error::Error::source
///
/// # Example
///
/// ```
/// # use std::fmt::{self, Debug, Display, Formatter};
/// # #[derive(Debug)] enum MyErrorKind { Variant }
/// # impl Display for MyErrorKind {
/// #     fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
/// #         Debug::fmt(self, f)
/// #     }
/// # }
/// # fn main() { test().unwrap() }
/// # fn test() -> Option<()> {
/// use std::error::Error as StdError;
///
/// use astral::error::Error;
///
/// let my_error = Error::new(MyErrorKind::Variant, "oh no!");
///
/// let my_error2 = Error::chained(MyErrorKind::Variant, "failed!", my_error);
///
/// assert_eq!(my_error2.source()?.to_string(), "oh no!");
/// # Some(())
/// # }
/// ```
Creates a new error from a known kind of error as well as an arbitrary
error payload and keeps another payload as source error.

The `error` argument is an arbitrary payload which will be contained in
this `Error`. The `source` argument is an error, which will be returned
by [`Error::source`]


Creates a new error from a known kind of error as well as an arbitrary error payload and keeps another payload as source error . The ` error ` argument is an arbitrary payload which will be contained in this ` Error ` . The ` source ` argument is an error which will be returned by [ ` Error :: source ` ]
pub fn chained<E, S>(kind: Kind, error: E, source: S) -> Self
	where
		E: Into<Box<dyn error::Error + Send + Sync>>,
		S: Into<Box<dyn error::Error + Send + Sync>>,
	{
		Self {
			repr: Repr::Chained(Box::new(Chained {
				kind,
				error: error.into(),
				source: source.into(),
			})),
		}
	}
pub fn chained < E , S > ( kind : Kind , error : E , source : S ) -> Self where E : Into < Box < dyn error :: Error + Send + Sync > > , S : Into < Box < dyn error :: Error + Send + Sync > > , { Self { repr : Repr :: Chained ( Box :: new ( Chained { kind , error : error . into ( ) , source : source . into ( ) , } ) ) , } }
Creates a new error from a known kind of error as well as an arbitrary
error payload and keeps another payload as source error.
Creates a new error from a known kind of error as well as an arbitrary error payload and keeps another payload as source error .
kind
Kind
error
E
source
S
kind
Kind
error
E
source
S
example
None
use std::fmt::{self, debug, display, formatter};
None
#[derive(debug)] enum myerrorkind { variant }
None
impl display for myerrorkind {
None
fn fmt(&self, f: &mut formatter<'_>) -> fmt::result {
None
debug::fmt(self, f)
None
}
None
}
None
fn main() { test().unwrap() }
None
fn test() -> option<()> {
use std::error::Error as StdError.

use astral::error::Error.

let my_error = Error::new(MyErrorKind::Variant, "oh no!").

let my_error2 = Error::chained(MyErrorKind::Variant, "failed!", my_error).


use std :: error :: Error as StdError . use astral :: error :: Error . let my_error = Error :: new ( MyErrorKind :: Variant " oh no! " ) . let my_error2 = Error :: chained ( MyErrorKind :: Variant " failed! " my_error ) .
some(())
None
}
None