Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tranzystorekk/anyhoo

Auto-complete your anyhow usage!
https://github.com/tranzystorekk/anyhoo

error-handling rust-library

Last synced: 16 days ago
JSON representation

Auto-complete your anyhow usage!

Awesome Lists containing this project

README

        

# anyhoo

## About

Auto-complete your functions to use `?` expressions and return `anyhow::Result` with less boilerplate!

## Usage with cargo

For convenience, `anyhoo` reexports `anyhow` as `anyhoo::anyhow`:

```toml
[dependencies]
anyhoo = { git = "https://github.com/tranzystorek-io/anyhoo", features = ["reexport"] }
```

You can opt out of this feature if you're using a particular version of `anyhow`.

## Example

A function that reads a line and parses it to an integer.

Default rusty idiom:

```rs
fn parse_line() -> anyhow::Result {
let mut input = String::new();
std::io::stdin().read_line(&mut input)?;

let result = input.parse();
Ok(result)
}
```

With `anyhoo`:

```rs
#[anyhoo::anyhoo]
fn parse_line() -> i32 {
let mut input = String::new();
std::io::stdin().read_line(&mut input)?;

input.parse()?
}
```