Skip to content

Instantly share code, notes, and snippets.

@BornPsych
Created March 25, 2025 08:45
Show Gist options
  • Select an option

  • Save BornPsych/e7062a0eac9d0b34ca013ecf6c6a9cd2 to your computer and use it in GitHub Desktop.

Select an option

Save BornPsych/e7062a0eac9d0b34ca013ecf6c6a9cd2 to your computer and use it in GitHub Desktop.
Rust Error file quick start
pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug)]
pub enum Error {}
// region: --- Error Boilerplate
impl core::fmt::Display for Error {
fn fmt(
&self,
fmt: &mut core::fmt::Formatter,
) -> core::result::Result<(), core::fmt::Error> {
write!(fmt, "{self:?}")
}
}
impl std::error::Error for Error {}
// endregion: --- Error Boilerplate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment