pub struct EngineBuilder<RequestCtx = ()> where
    RequestCtx: RequestContext
{ /* private fields */ }
Expand description

Implements the builder pattern for Warpgrapher engines

Examples



let config = Configuration::default();
let engine = Engine::<()>::new(config, NoDatabasePool {}).build()?;

Implementations

Adds resolvers to the engine

Examples

let resolvers = Resolvers::<()>::new();

let config = Configuration::default();

let mut engine = Engine::<()>::new(config, NoDatabasePool {})
    .with_resolvers(resolvers)
    .build()?;

Adds validators to the engine

Examples

let validators = Validators::new();

let config = Configuration::default();

let mut engine = Engine::<()>::new(config, NoDatabasePool {})
    .with_validators(validators)
    .build()?;

Adds event handlers to the engine

Examples

let event_handlers = EventHandlerBag::<()>::new();

let config = Configuration::default();

let mut engine = Engine::<()>::new(config, NoDatabasePool {})
    .with_event_handlers(event_handlers)
    .build()?;

Sets the version of the app

Examples

let config = Configuration::default();

let mut engine = Engine::<()>::new(config, NoDatabasePool {})
    .with_version("1.0.0".to_string())
    .build()?;

Builds a configured Engine including generating the data model, CRUD operations, and custom endpoints from the Configuration c. Returns the Engine.

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.

Returns an Error variant SchemaItemNotFound if there is an error in the configuration, specifically if the configuration of type A references type B, but type B cannot be found.

Returns an Error variant ResolverNotFound if there is a resolver defined in the configuration for which no ResolverFunc has been added to the Resolvers collection applied to the EngineBuilder with with_resolvers.

Returns an Error variant ValidatorNotFound if there is a validator defined in the configuration for which no ValidatorFunc has been added to the Validators collection applied to the EngineBuilder with with_validators.

Returns an

Examples

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

let mut engine = Engine::<()>::new(config, NoDatabasePool {}).build()?;

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

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

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

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