Struct juniper::Registry
[−]
[src]
pub struct Registry<'r> { pub types: FnvHashMap<Name, MetaType<'r>>, }
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>>
Currently registered types
Methods
impl<'r> Registry<'r>
[src]
fn new(types: FnvHashMap<Name, MetaType<'r>>) -> Registry<'r>
[src]
Construct a new registry
fn get_type<T>(&mut self, info: &T::TypeInfo) -> Type<'r> where
T: GraphQLType,
[src]
T: GraphQLType,
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.
fn field<T>(&mut self, name: &str, info: &T::TypeInfo) -> Field<'r> where
T: GraphQLType,
[src]
T: GraphQLType,
Create a field with the provided name
fn arg<T>(&mut self, name: &str, info: &T::TypeInfo) -> Argument<'r> where
T: GraphQLType + FromInputValue,
[src]
T: GraphQLType + FromInputValue,
Create an argument with the provided name
fn arg_with_default<T>(
&mut self,
name: &str,
value: &T,
info: &T::TypeInfo
) -> Argument<'r> where
T: GraphQLType + ToInputValue + FromInputValue,
[src]
&mut self,
name: &str,
value: &T,
info: &T::TypeInfo
) -> Argument<'r> where
T: GraphQLType + ToInputValue + FromInputValue,
Create an argument with a default value
When called with type T
, the actual argument will be given the type
Option<T>
.
fn build_scalar_type<T>(&mut self, info: &T::TypeInfo) -> ScalarMeta<'r> where
T: FromInputValue + GraphQLType,
[src]
T: FromInputValue + GraphQLType,
Create a scalar meta type
This expects the type to implement FromInputValue
.
fn build_list_type<T: GraphQLType>(
&mut self,
info: &T::TypeInfo
) -> ListMeta<'r>
[src]
&mut self,
info: &T::TypeInfo
) -> ListMeta<'r>
Create a list meta type
fn build_nullable_type<T: GraphQLType>(
&mut self,
info: &T::TypeInfo
) -> NullableMeta<'r>
[src]
&mut self,
info: &T::TypeInfo
) -> NullableMeta<'r>
Create a nullable meta type
fn build_object_type<T>(
&mut self,
info: &T::TypeInfo,
fields: &[Field<'r>]
) -> ObjectMeta<'r> where
T: GraphQLType,
[src]
&mut self,
info: &T::TypeInfo,
fields: &[Field<'r>]
) -> ObjectMeta<'r> where
T: GraphQLType,
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.
fn build_enum_type<T>(
&mut self,
info: &T::TypeInfo,
values: &[EnumValue]
) -> EnumMeta<'r> where
T: FromInputValue + GraphQLType,
[src]
&mut self,
info: &T::TypeInfo,
values: &[EnumValue]
) -> EnumMeta<'r> where
T: FromInputValue + GraphQLType,
Create an enum meta type
fn build_interface_type<T>(
&mut self,
info: &T::TypeInfo,
fields: &[Field<'r>]
) -> InterfaceMeta<'r> where
T: GraphQLType,
[src]
&mut self,
info: &T::TypeInfo,
fields: &[Field<'r>]
) -> InterfaceMeta<'r> where
T: GraphQLType,
Create an interface meta type builder, by providing a type info object.
fn build_union_type<T>(
&mut self,
info: &T::TypeInfo,
types: &[Type<'r>]
) -> UnionMeta<'r> where
T: GraphQLType,
[src]
&mut self,
info: &T::TypeInfo,
types: &[Type<'r>]
) -> UnionMeta<'r> where
T: GraphQLType,
Create a union meta type builder
fn build_input_object_type<T>(
&mut self,
info: &T::TypeInfo,
args: &[Argument<'r>]
) -> InputObjectMeta<'r> where
T: FromInputValue + GraphQLType,
[src]
&mut self,
info: &T::TypeInfo,
args: &[Argument<'r>]
) -> InputObjectMeta<'r> where
T: FromInputValue + GraphQLType,
Create an input object meta type builder