[][src]Struct warpgrapher::engine::config::Config

pub struct Config {
    pub version: i32,
    pub model: Vec<Type>,
    pub endpoints: Vec<Endpoint>,
}

Configuration item for a Warpgrapher data model. The configuration contains the version of the Warpgrapher configuration file format, and a vector of Type structures.

Examples

use warpgrapher::engine::config::Config;

let c = Config::new(1, Vec::new(), Vec::new());

Fields

version: i32

Version of the Warpgrapher configuration file format used

model: Vec<Type>

A vector of Type structures, each defining one type in the data model

endpoints: Vec<Endpoint>

A vector of Endpoint structures, each defining an a custom root endpoint in the graphql schema

Implementations

impl Config[src]

pub fn new(version: i32, model: Vec<Type>, endpoints: Vec<Endpoint>) -> Config[src]

Creates a new, empty Config data structure

Examples

use warpgrapher::engine::config::Config;

let c = Config::new(1, Vec::new(), Vec::new());

pub fn default() -> Config[src]

Creates a new, Config data structure with default values

Examples

use warpgrapher::engine::config::Config;

let config = Config::default();

pub fn from_string(data: String) -> Result<Config, Error>[src]

Creates a new Config data structure from a yaml formatted config string.

pub fn from_file(path: String) -> Result<Config, Error>[src]

Creates a new Config data structure from the contents of the specified config file. Returns error if the config file could not be opened or deserialized.

pub fn validate(&self) -> Result<(), Error>[src]

Validates the Config data structure. Checks to verify no duplicate Endpoint or Type, and that the Endpoint input/output types are defined in the model. Returns a Result<(), Error> where the error could be one of:

  • [ConfigTypeDuplicateError] if any Type is defined twice in the configuration.
  • [ConfigEndpointDuplicateError] if any Endpoint Type is defined twice in the configuration.
  • [ConfigEndpointMissingTypeError] if an Endpoint does not have a corresponding Type defined.

#Example

    use warpgrapher::engine::config::{Config};

    let config = Config::new(1, Vec::new(), Vec::new());
    config.validate();

Trait Implementations

impl Clone for Config[src]

impl Debug for Config[src]

impl<'de> Deserialize<'de> for Config[src]

impl Eq for Config[src]

impl Hash for Config[src]

impl Ord for Config[src]

impl PartialEq<Config> for Config[src]

impl PartialOrd<Config> for Config[src]

impl Serialize for Config[src]

impl StructuralEq for Config[src]

impl StructuralPartialEq for Config[src]

Auto Trait Implementations

impl RefUnwindSafe for Config

impl Send for Config

impl Sync for Config

impl Unpin for Config

impl UnwindSafe for Config

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,