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]

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 call with_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.

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"));

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.

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"));

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.

Returns the API key.

If no API key was set, it returns None.

Returns the API URL.

Trait Implementations

impl Clone for Settings
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Settings
[src]

Formats the value using the given formatter.

impl Default for Settings
[src]

Creates settings with default values.

Returns the same value as Settings::new().