[−][src]Struct juniper::Registry
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]
S: ScalarValue + 'r,
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]
T: GraphQLType<S>,
&'b S: ScalarRefValue<'b>,
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]
T: GraphQLType<S>,
&'b S: ScalarRefValue<'b>,
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]
T: GraphQLType<S> + FromInputValue<S>,
&'b S: ScalarRefValue<'b>,
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]
&mut self,
name: &str,
value: &T,
info: &T::TypeInfo
) -> Argument<'r, S> where
T: GraphQLType<S> + ToInputValue<S> + FromInputValue<S>,
&'b S: ScalarRefValue<'b>,
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]
T: FromInputValue<S> + GraphQLType<S> + ParseScalarValue<S> + 'r,
&'b S: ScalarRefValue<'b>,
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]
&mut self,
info: &T::TypeInfo
) -> ListMeta<'r> where
&'b S: ScalarRefValue<'b>,
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]
&mut self,
info: &T::TypeInfo
) -> NullableMeta<'r> where
&'b S: ScalarRefValue<'b>,
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]
&mut self,
info: &T::TypeInfo,
fields: &[Field<'r, S>]
) -> ObjectMeta<'r, S> where
T: GraphQLType<S>,
&'b S: ScalarRefValue<'b>,
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]
&mut self,
info: &T::TypeInfo,
values: &[EnumValue]
) -> EnumMeta<'r, S> where
T: FromInputValue<S> + GraphQLType<S>,
&'b S: ScalarRefValue<'b>,
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]
&mut self,
info: &T::TypeInfo,
fields: &[Field<'r, S>]
) -> InterfaceMeta<'r, S> where
T: GraphQLType<S>,
&'b S: ScalarRefValue<'b>,
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]
&mut self,
info: &T::TypeInfo,
types: &[Type<'r>]
) -> UnionMeta<'r> where
T: GraphQLType<S>,
&'b S: ScalarRefValue<'b>,
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]
&mut self,
info: &T::TypeInfo,
args: &[Argument<'r, S>]
) -> InputObjectMeta<'r, S> where
T: FromInputValue<S> + GraphQLType<S>,
&'b S: ScalarRefValue<'b>,
Create an input object meta type builder
Auto Trait Implementations
impl<'r, S> Send for Registry<'r, S> where
S: Send,
S: Send,
impl<'r, S> Sync for Registry<'r, S> where
S: Sync,
S: Sync,
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,