[][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

Implementations

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: ?Sized>(&mut self, info: &T::TypeInfo) -> Type<'r> where
    T: GraphQLType<S>, 
[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: ?Sized>(
    &mut self,
    name: &str,
    info: &T::TypeInfo
) -> Field<'r, S> where
    T: GraphQLType<S>, 
[src]

Create a field with the provided name

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

Create an argument with the provided name

pub fn arg_with_default<T: ?Sized>(
    &mut self,
    name: &str,
    value: &T,
    info: &T::TypeInfo
) -> Argument<'r, S> where
    T: GraphQLType<S> + ToInputValue<S> + FromInputValue<S>, 
[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: ?Sized>(
    &mut self,
    info: &T::TypeInfo
) -> ScalarMeta<'r, S> where
    T: FromInputValue<S> + GraphQLType<S> + ParseScalarValue<S> + 'r, 
[src]

Create a scalar meta type

This expects the type to implement FromInputValue.

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

Create a list meta type

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

Create a nullable meta type

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

Create an object meta type

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: ?Sized>(
    &mut self,
    info: &T::TypeInfo,
    values: &[EnumValue]
) -> EnumMeta<'r, S> where
    T: FromInputValue<S> + GraphQLType<S>, 
[src]

Create an enum meta type

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

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

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

Create a union meta type

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

Create an input object meta type

Auto Trait Implementations

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

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

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

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

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

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.

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