pub struct Configuration {
    pub model: Vec<Type>,
    /* private fields */
}
Expand description

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

Examples

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

Fields

model: Vec<Type>

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

Implementations

Creates a new Configuration data structure with the version, Type vector, and Endpoint vector provided as arguments.

Examples

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

Returns an iterator over the Endpoint structs defining custom root endpoints in the GraphQL schema

Examples

let c = Configuration::new(1, Vec::new(), Vec::new());
for e in c.endpoints() {
    let _name = e.name();
}

Returns an iterator over the Type structs defining types in the GraphQL schema

Examples

let c = Configuration::new(1, Vec::new(), Vec::new());
for t in c.types() {
    let _name = t.name();
}

Validates the Configuration data structure. Checks that there are no duplicate Endpoint or Type items, and that the Endpoint input/output types are defined in the model. Returns () if there are no validation errors.

Errors

Returns an Error variant ConfigItemDuplicated if there is more than one type or more than one endpoint that use the same name.

Returns an Error variant ConfigItemReserved if a named configuration item, such as an endpoint or type, has a name that is a reserved word, such as “ID” or the name of a GraphQL scalar type.

Example

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

Returns the version number of the configuration format used for the configuration

Examples

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

assert_eq!(1, c.version());

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more