Struct lockchain_http::state::ApiState[][src]

pub struct ApiState<B, V> where
    B: Body,
    V: Vault<B>, 
{ pub bound_scope: bool, pub working_dir: PathBuf, pub administrative: bool, // some fields omitted }

An in-memory API state object which is delegated to all handlers

This mechanism serves two purposes

  1. Configuration of the API, beyond simple paramters provided to the server_start call
  2. Buffering and pre-loading of certain vault components that need to be accessed via the handlers

It provides some simple query functions for handlers to work on, as well as expose raw configuration fields to be written

let state: ApiState<B, V> = ApiState {
    bound_scope: false,
    working_dir: ".".into(),
    ..
};

(Replace B and V with your generics 🙂)

Fields

Signal if the API handlers are allowed outside their working dir

Provide a working directory

Completely disabe administrative actions

Methods

impl<B, V> ApiState<B, V> where
    B: Body,
    V: Vault<B>, 
[src]

Load an existing API state from an encoded string

Store an in-memory API state to an encoded string

Return a list of string slices for each vault in scope

Simply return the number of known vaults

Trait Implementations

impl<B, V> Default for ApiState<B, V> where
    B: Body,
    V: Vault<B>, 
[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl<B, V> Send for ApiState<B, V>

impl<B, V> Sync for ApiState<B, V> where
    B: Sync,
    V: Sync