pub fn new<E>(kind: Kind, error: E) -> Self
	where
		E: Into<Box<dyn error::Error + Send + Sync>>,
	{
		Self {
			repr: Repr::Custom(Box::new(Custom {
				kind,
				error: error.into(),
			})),
		}
	}
/// Creates a new error from a known kind of error as well as an arbitrary
/// error payload. The `error` argument is an arbitrary payload which will
/// be contained in this `Error`. The resulting error don't have a source
/// error returned by [`Error::source`].
///
/// [`Error::source`]: std::error::Error::source
///
/// # Example
///
/// ```
/// # use std::fmt::{self, Debug, Display, Formatter};
/// # #[derive(Debug, PartialEq)] enum MyErrorKind { Variant }
/// # impl Display for MyErrorKind {
/// #     fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
/// #         Debug::fmt(self, f)
/// #     }
/// # }
/// use std::error::Error as StdError;
///
/// use astral::error::Error;
///
/// let my_error = Error::new(MyErrorKind::Variant, "oh no!");
///
/// let my_error2 = Error::new(MyErrorKind::Variant, my_error);
///
/// assert!(my_error2.source().is_none());
/// ```
Creates a new error from a known kind of error as well as an arbitrary
error payload. The `error` argument is an arbitrary payload which will
be contained in this `Error`. The resulting error don't have a source
error returned by [`Error::source`].


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

use astral::error::Error.

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

let my_error2 = Error::new(MyErrorKind::Variant, 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 :: new ( MyErrorKind :: Variant my_error ) .