pub struct Match { /* private fields */ }Expand description
Struct which stores matches data for search keyword
Implementations§
Source§impl Match
impl Match
Sourcepub fn symbol(&self) -> &str
pub fn symbol(&self) -> &str
Return symbol
#[tokio::main]
async fn main() {
let api = alpha_vantage::set_api("demo", reqwest::Client::new());
let search = api.search("BA").json().await.unwrap();
let symbol = search.matches()[0].symbol();
assert_eq!(symbol, "BA");
}Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Return name for symbol
#[tokio::main]
async fn main() {
let api = alpha_vantage::set_api("demo", reqwest::Client::new());
let search = api.search("BA").json().await.unwrap();
let name = search.matches()[0].name();
assert_eq!(name, "Boeing Company");
}Sourcepub fn stock_type(&self) -> &str
pub fn stock_type(&self) -> &str
Return stock type
#[tokio::main]
async fn main() {
let api = alpha_vantage::set_api("demo", reqwest::Client::new());
let search = api.search("BA").json().await.unwrap();
let stock_type = search.matches()[0].stock_type();
assert_eq!(stock_type, "Equity");
}Sourcepub fn region(&self) -> &str
pub fn region(&self) -> &str
Return region of search data
#[tokio::main]
async fn main() {
let api = alpha_vantage::set_api("demo", reqwest::Client::new());
let search = api.search("BA").json().await.unwrap();
let region = search.matches()[0].region();
assert_eq!(region, "United States");
}Sourcepub fn market_open(&self) -> &str
pub fn market_open(&self) -> &str
Return market open time
#[tokio::main]
async fn main() {
let api = alpha_vantage::set_api("demo", reqwest::Client::new());
let search = api.search("BA").json().await.unwrap();
let market_open = search.matches()[0].market_open();
assert_eq!(market_open, "09:30");
}Sourcepub fn market_close(&self) -> &str
pub fn market_close(&self) -> &str
Return market close time
#[tokio::main]
async fn main() {
let api = alpha_vantage::set_api("demo", reqwest::Client::new());
let search = api.search("BA").json().await.unwrap();
let market_close = search.matches()[0].market_close();
assert_eq!(market_close, "16:00");
}Sourcepub fn currency(&self) -> &str
pub fn currency(&self) -> &str
Return currency
#[tokio::main]
async fn main() {
let api = alpha_vantage::set_api("demo", reqwest::Client::new());
let search = api.search("BA").json().await.unwrap();
let currency = search.matches()[0].currency();
assert_eq!(currency, "USD");
}Sourcepub fn match_score(&self) -> f64
pub fn match_score(&self) -> f64
Return match score
#[tokio::main]
async fn main() {
let api = alpha_vantage::set_api("demo", reqwest::Client::new());
let search = api.search("BA").json().await.unwrap();
let match_score = search.matches()[0].match_score();
assert_eq!(match_score, 1.0);
}Trait Implementations§
Source§impl<'de> Deserialize<'de> for Match
impl<'de> Deserialize<'de> for Match
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Match
impl RefUnwindSafe for Match
impl Send for Match
impl Sync for Match
impl Unpin for Match
impl UnwindSafe for Match
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more