File: mod.rs

package info (click to toggle)
rust-anyhow 1.0.99-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 500 kB
  • sloc: makefile: 2
file content (14 lines) | stat: -rw-r--r-- 271 bytes parent folder | download | duplicates (71)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use anyhow::{bail, Result};
use std::io;

pub fn bail_literal() -> Result<()> {
    bail!("oh no!");
}

pub fn bail_fmt() -> Result<()> {
    bail!("{} {}!", "oh", "no");
}

pub fn bail_error() -> Result<()> {
    bail!(io::Error::new(io::ErrorKind::Other, "oh no!"));
}