borked 0.2.0

Simple and convienient error handling library for rust
Documentation
  • Coverage
  • 89.47%
    17 out of 19 items documented1 out of 15 items with examples
  • Size
  • Source code size: 52.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.93 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Tristan_C/rust-borked
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • StanTh3Man

Rust-Borked

Error handling for rust.

This Does a very similar thing to existing projects like failure - Rust or error_chain but I was never quite satisfied with the other implementations.

This was my first time really mucking about with Rust's Trait system, so if I did anything incrdably dumb, or if improvments could otherwise be made, I'd love to hear about it. :)

Install

borked is on crates.io so it can be added to Cargo.toml:

[dependencies]
...
borked = "0.1.0"

Example

This crate provides features for working with any error that implements the std::error::Error Trait. But Types implementing BorkChain are most useful with this crate.

#[macro_use]
extern crate borked;
use borked::*;

fn doing_stuff() -> Borkable<u32>{
	// Do something useful...
	// Encounter error...
	Bork!("Oh No!");
	// Never reached in this case.
	return Ok(0);
}

fn q_mark()-> Borkable<u32>{
	let e = u32::from_str_radix("Obviously_not_gonna_work", 10)?;
	return Ok(e);
}

fn with_bork() -> Borkable<u32>{
	let e = u32::from_str_radix("Obviously_not_gonna_work", 10)
		.bork_with(BaseBork::msg("AHHH It Didn't Work!"))?;
	return Ok(e+7);

}