[][src]Struct juniper::Registry

pub struct Registry<'r, S = DefaultScalarValue> {
    pub types: FnvHashMap<Name, MetaType<'r, S>>,
}

A type registry used to build schemas

The registry gathers metadata for all types in a schema. It provides convenience methods to convert types implementing the GraphQLType trait into Type instances and automatically registers them.

Fields

types: FnvHashMap<Name, MetaType<'r, S>>

Currently registered types

Methods

impl<'r, S> Registry<'r, S> where
    S: ScalarValue + 'r, 
[src]

pub fn new(types: FnvHashMap<Name, MetaType<'r, S>>) -> Registry<'r, S>[src]

Construct a new registry

pub fn get_type<T>(&mut self, info: &T::TypeInfo) -> Type<'r> where
    T: GraphQLType<S>,
    &'b S: ScalarRefValue<'b>, 
[src]

Get the Type instance for a given GraphQL type

If the registry hasn't seen a type with this name before, it will construct its metadata and store it.

pub fn field<T>(&mut self, name: &str, info: &T::TypeInfo) -> Field<'r, S> where
    T: GraphQLType<S>,
    &'b S: ScalarRefValue<'b>, 
[src]

Create a field with the provided name

pub fn arg<T>(&mut self, name: &str, info: &T::TypeInfo) -> Argument<'r, S> where
    T: GraphQLType<S> + FromInputValue<S>,
    &'b S: ScalarRefValue<'b>, 
[src]

Create an argument with the provided name

pub fn arg_with_default<T>(
    &mut self,
    name: &str,
    value: &T,
    info: &T::TypeInfo
) -> Argument<'r, S> where
    T: GraphQLType<S> + ToInputValue<S> + FromInputValue<S>,
    &'b S: ScalarRefValue<'b>, 
[src]

Create an argument with a default value

When called with type T, the actual argument will be given the type Option<T>.

pub fn build_scalar_type<T>(&mut self, info: &T::TypeInfo) -> ScalarMeta<'r, S> where
    T: FromInputValue<S> + GraphQLType<S> + ParseScalarValue<S> + 'r,
    &'b S: ScalarRefValue<'b>, 
[src]

Create a scalar meta type

This expects the type to implement FromInputValue.

pub fn build_list_type<T: GraphQLType<S>>(
    &mut self,
    info: &T::TypeInfo
) -> ListMeta<'r> where
    &'b S: ScalarRefValue<'b>, 
[src]

Create a list meta type

pub fn build_nullable_type<T: GraphQLType<S>>(
    &mut self,
    info: &T::TypeInfo
) -> NullableMeta<'r> where
    &'b S: ScalarRefValue<'b>, 
[src]

Create a nullable meta type

pub fn build_object_type<T>(
    &mut self,
    info: &T::TypeInfo,
    fields: &[Field<'r, S>]
) -> ObjectMeta<'r, S> where
    T: GraphQLType<S>,
    &'b S: ScalarRefValue<'b>, 
[src]

Create an object meta type builder

To prevent infinite recursion by enforcing ordering, this returns a function that needs to be called with the list of fields on the object.

pub fn build_enum_type<T>(
    &mut self,
    info: &T::TypeInfo,
    values: &[EnumValue]
) -> EnumMeta<'r, S> where
    T: FromInputValue<S> + GraphQLType<S>,
    &'b S: ScalarRefValue<'b>, 
[src]

Create an enum meta type

pub fn build_interface_type<T>(
    &mut self,
    info: &T::TypeInfo,
    fields: &[Field<'r, S>]
) -> InterfaceMeta<'r, S> where
    T: GraphQLType<S>,
    &'b S: ScalarRefValue<'b>, 
[src]

Create an interface meta type builder, by providing a type info object.

pub fn build_union_type<T>(
    &mut self,
    info: &T::TypeInfo,
    types: &[Type<'r>]
) -> UnionMeta<'r> where
    T: GraphQLType<S>,
    &'b S: ScalarRefValue<'b>, 
[src]

Create a union meta type builder

pub fn build_input_object_type<T>(
    &mut self,
    info: &T::TypeInfo,
    args: &[Argument<'r, S>]
) -> InputObjectMeta<'r, S> where
    T: FromInputValue<S> + GraphQLType<S>,
    &'b S: ScalarRefValue<'b>, 
[src]

Create an input object meta type builder

Auto Trait Implementations

impl<'r, S> RefUnwindSafe for Registry<'r, S> where
    S: RefUnwindSafe

impl<'r, S> Send for Registry<'r, S> where
    S: Send

impl<'r, S> Sync for Registry<'r, S> where
    S: Sync

impl<'r, S> Unpin for Registry<'r, S> where
    S: Unpin

impl<'r, S> UnwindSafe for Registry<'r, S> where
    S: UnwindSafe

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> From<T> for T[src]

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

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.