Struct retdec::settings::Settings
[−]
[src]
pub struct Settings { /* fields omitted */ }
Settings for the provided services.
To use any of the services (decompiler, fileinfo), you have to provide your
own API key either by calling with_api_key()
or by setting the
RETDEC_API_KEY
environment variable.
Examples
use retdec::settings::Settings; let s = Settings::new() .with_api_key("MY-API-KEY"); assert_eq!(s.api_key(), Some("MY-API-KEY"));
Methods
impl Settings
[src]
fn new() -> Self
Creates new settings.
The default values depend on whether the following two environment variables are set:
RETDEC_API_KEY
: If set, its value will be used as the default API key. Otherwise, no API key will be set and you have to callwith_api_key()
to set it.RETDEC_API_URL
: If set, its value will be used as the default. Otherwise, the default API URL is used. For public use, the default URL is what you want. Setting a custom API URL is only useful for internal development.
fn with_api_key<K: Into<String>>(self, new_api_key: K) -> Self
Sets an API key when used as a builder.
Without setting an API key, you will be unable to use any of the provided services (decompiler, fileinfo).
Examples
use retdec::settings::Settings; let s = Settings::new() .with_api_key("MY-API-KEY"); assert_eq!(s.api_key(), Some("MY-API-KEY"));
fn with_api_url<U: Into<String>>(self, new_api_url: U) -> Self
Sets a custom URL to the API when used as a builder.
For public use, the default URL is what you want. This function is only useful for internal development.
fn set_api_key<K: Into<String>>(&mut self, new_api_key: K)
Sets an API key.
Without setting an API key, you will be unable to use any of the provided services (decompiler, fileinfo).
Examples
use retdec::settings::Settings; let mut s = Settings::new(); s.set_api_key("MY-API-KEY"); assert_eq!(s.api_key(), Some("MY-API-KEY"));
fn set_api_url<U: Into<String>>(&mut self, new_api_url: U)
Sets a custom URL to the API.
For public use, the default URL is what you want. This function is only useful for internal development.
fn api_key(&self) -> Option<&str>
Returns the API key.
If no API key was set, it returns None
.
fn api_url(&self) -> &str
Returns the API URL.
Trait Implementations
impl Clone for Settings
[src]
fn clone(&self) -> Settings
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more