Skip to main content

ClientConfig

Struct ClientConfig 

Source
pub struct ClientConfig { /* private fields */ }
Expand description

What a client needs to find and call one service, including how much it trusts its environment. Pass it to Client::connect_expecting (verified host) or Client::connect_config (hardened root, unverified host).

The suite root is chosen like this:

  • suite given: that suite, as is. With ignore_env_overrides on, a suite that came from the environment (Suite::resolve, see Suite::env_derived) is refused, so the switch cannot be defeated by passing Suite::resolve() in.
  • not given, ignore_env_overrides off: Suite::resolve, which honours RIGHTKIT_SUITE_ROOT, RIGHT_SUITE_DIR, ORTHIC_SHARED_DIR and HOME/XDG_DATA_HOME/ LOCALAPPDATA. For QA builds and isolated dev profiles.
  • not given, ignore_env_overrides on: Suite::per_user_default, from the account database. For release builds. A launcher that sets environment variables cannot redirect the client.

A host that wants the same switch calls Suite::resolve_ignoring_env_overrides; the host functions themselves take the suite as an argument and read no environment variable.

Implementations§

Source§

impl ClientConfig

Source

pub fn new(service: impl Into<String>, app: impl Into<String>) -> Self

Talk to service as app, with the DEFAULT_DEADLINE, the suite resolved from the environment, and no hardening. Release builds should add ignore_env_overrides(true).

Source

pub fn secret(self, secret: PrivateSecret) -> Self

Send secret on the hello and on every request, for a host that requires one (see ServiceConfig::private_secret). Pair it with Client::connect_expecting: a secret goes to whatever answered at the endpoint.

Source

pub fn suite(self, suite: Suite) -> Self

Use this suite instead of resolving one.

Source

pub fn deadline(self, deadline: Option<Duration>) -> Self

Per-request deadline, as for Client::connect_with (None = unbounded).

Source

pub fn ignore_env_overrides(self, ignore: bool) -> Self

Refuse environment redirection: the suite root comes only from the per-user default (Suite::per_user_default), and an explicit suite that was derived from the environment is an error. Release builds of an app and of its command-line engine set this; QA builds and isolated test runs do not (they need RIGHTKIT_SUITE_ROOT).

Source

pub fn service(&self) -> &str

Source

pub fn app(&self) -> &str

Source

pub fn ignores_env_overrides(&self) -> bool

Whether ignore_env_overrides is on.

Source

pub fn resolve_suite(&self) -> Result<Suite, SuiteError>

The suite this configuration connects through, per the rules on ClientConfig.

Trait Implementations§

Source§

impl Clone for ClientConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.