[][src]Type Definition anyhow::Result

type Result<T, E = Error> = Result<T, E>;

Result<T, Error>

This is a reasonable return type to use throughout your application but also for fn main; if you do, failures will be printed along with any context and a backtrace if one was captured.

Example

use anyhow::Result;

fn main() -> Result<()> {
    let config = std::fs::read_to_string("cluster.json")?;
    let map: ClusterMap = serde_json::from_str(&config)?;
    println!("cluster info: {:#?}", map);
    Ok(())
}