Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tranzystorekk/anyhoo
Auto-complete your anyhow usage!
https://github.com/tranzystorekk/anyhoo
error-handling rust-library
Last synced: 21 days ago
JSON representation
Auto-complete your anyhow usage!
- Host: GitHub
- URL: https://github.com/tranzystorekk/anyhoo
- Owner: tranzystorekk
- Created: 2021-11-19T15:27:30.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-09T11:40:28.000Z (over 2 years ago)
- Last Synced: 2023-10-28T06:24:41.692Z (about 1 year ago)
- Topics: error-handling, rust-library
- Language: Rust
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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()?
}
```