You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rusty-man/tests/snapshots/output__1.54.0_html_type_an...

37 lines
1.1 KiB
Plaintext

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

---
source: tests/output.rs
expression: "get_stdout(path, &[\"anyhow::Result\"])"
---
anyhow Typedef anyhow::Result rusty-man
SYNOPSIS
type Result<T, E = Error> = Result<T, E>;
DESCRIPTION
`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.
`anyhow::Result` may be used with one *or* two type parameters.
use anyhow::Result;
fn demo1() -> Result<T> {...}
// ^ equivalent to std::result::Result<T, anyhow::Error>
fn demo2() -> Result<T, OtherError> {...}
// ^ equivalent to std::result::Result<T, OtherError>
# 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(())
}