Skip to main content

Configuration

Trait Configuration 

Source
pub trait Configuration {
    // Required methods
    fn from_env() -> Self;
    fn with_body(self, value: impl Into<String>) -> Self;
    fn with_domain(self, value: impl Into<String>) -> Self;
    fn with_identifier(self, value: impl Into<String>) -> Self;
    fn token(&self) -> &str;
    fn domain(&self) -> &str;
    fn identifier(&self) -> Option<&str>;
    fn with_params(self, params: Vec<Param>) -> Self;
    fn params(&self) -> &[Param];
}
Expand description

Trait to standardize configuration loading from environment variables and modification with new values

Required Methods§

Source

fn from_env() -> Self

Populate values from environment (e.g., .env file or environment variables)

Source

fn with_body(self, value: impl Into<String>) -> Self

Return a copy of this configuration with the specified request body payload set

Source

fn with_domain(self, value: impl Into<String>) -> Self

Return a copy of this configuration with the specified domain set

Source

fn with_identifier(self, value: impl Into<String>) -> Self

Return a copy of this configuration with the specified resource identifier set

Source

fn token(&self) -> &str

Return the authentication token

Source

fn domain(&self) -> &str

Return the API domain

Source

fn identifier(&self) -> Option<&str>

Return the optional resource identifier

Source

fn with_params(self, params: Vec<Param>) -> Self

Return a copy of this configuration with custom API parameters set. These are appended to internally-constructed parameters before each request.

Source

fn params(&self) -> &[Param]

Return any custom API parameters

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Configuration for acorn::io::api::citeas::Options

Source§

impl Configuration for acorn::io::api::gitlab::Options

Source§

impl Configuration for acorn::io::api::openai::Options

Source§

impl Configuration for acorn::io::api::orcid::Options

Source§

impl Configuration for acorn::io::api::raid::Options

Source§

impl Configuration for acorn::io::api::ror::Options