Struct retdec::test::Test
[−]
[src]
pub struct Test { /* fields omitted */ }
Testing service.
Methods
impl Test
[src]
fn new(settings: Settings) -> Self
Creates a new instance of the testing service.
fn auth(&self) -> Result<()>
Tries to authenticate to the retdec.com
's API.
Returns Ok(())
when the authentication succeeds. Otherwise, it
returns an error.
Examples
use retdec::settings::Settings; use retdec::test::Test; let settings = Settings::new() .with_api_key("MY-API-KEY"); let test = Test::new(settings); test.auth()?;
fn echo(
&self,
params: &HashMap<String, String>
) -> Result<HashMap<String, String>>
&self,
params: &HashMap<String, String>
) -> Result<HashMap<String, String>>
Echoes back the given parameters (key-value pairs).
Examples
use std::collections::HashMap; use retdec::settings::Settings; use retdec::test::Test; let settings = Settings::new() .with_api_key("MY-API-KEY"); let test = Test::new(settings); let mut params = HashMap::new(); params.insert("param1".to_string(), "value1".to_string()); params.insert("param2".to_string(), "value2".to_string()); let result = test.echo(¶ms)?; assert_eq!(result.get("param1"), Some(&"value1".to_string())); assert_eq!(result.get("param2"), Some(&"value2".to_string()));