#![allow(unused)]
#[rustfmt::skip]
#[test]
fn doc_block_line_43() {
use finance_query::FinanceError;
let error = FinanceError::RateLimited { retry_after: Some(2) };
match &error {
FinanceError::RateLimited { retry_after } => {
if let Some(secs) = retry_after {
assert_eq!(*secs, 2);
}
}
FinanceError::SymbolNotFound { symbol, .. } => {
eprintln!("Symbol not found: {:?}", symbol);
}
_ => eprintln!("{}", error),
}
}
#[rustfmt::skip]
#[allow(dead_code)]
fn doc_block_line_171() {
use finance_query::Tickers;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let tickers = Tickers::builder(vec!["AAPL", "MSFT", "NOTREAL"]).build().await?;
let response = tickers.quotes().await?;
for (symbol, error_str) in &response.errors {
eprintln!("{}: {}", symbol, error_str);
}
println!("Success: {}, Failed: {}", response.success_count(), response.error_count());
if !response.all_successful() {
eprintln!("Some symbols failed");
}
Ok(())
}
}
#[rustfmt::skip]
#[test]
fn doc_block_line_197() {
use finance_query::{FinanceError, Operation, Provider};
let error = FinanceError::NotSupported {
provider: Provider::Yahoo,
operation: Operation::Quote,
candidates: Vec::new(),
};
match &error {
FinanceError::NotSupported { provider, operation, .. } => {
eprintln!("{} does not support {}", provider, operation);
}
FinanceError::NoProviderAvailable { operation, .. } => {
eprintln!("No provider available for {:?}", operation);
}
_ => {}
}
}