pub struct SchemaBuilder<Query, Mutation, Subscription> {/* private fields */ }
Expand description
Schema builder
Implementations§
Source§impl<Query, Mutation, Subscription>SchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription>SchemaBuilder<Query, Mutation, Subscription>
Sourcepub fnregister_input_type<T:InputType>(self) -> Self
pub fnregister_input_type<T:InputType>(self) -> Self
Manually register a input type in the schema.
You can use this function to register schema types that are not directlyreferenced.
Sourcepub fnregister_output_type<T:OutputType>(self) -> Self
pub fnregister_output_type<T:OutputType>(self) -> Self
Manually register a output type in the schema.
You can use this function to register schema types that are not directlyreferenced.
Sourcepub fndisable_introspection(self) -> Self
pub fndisable_introspection(self) -> Self
Disable introspection queries.
Sourcepub fnintrospection_only(self) -> Self
pub fnintrospection_only(self) -> Self
Only process introspection queries, everything else is processed as anerror.
Sourcepub fnlimit_complexity(self, complexity:usize) -> Self
pub fnlimit_complexity(self, complexity:usize) -> Self
Set the maximum complexity a query can have. By default, there is nolimit.
Sourcepub fnlimit_depth(self, depth:usize) -> Self
pub fnlimit_depth(self, depth:usize) -> Self
Set the maximum depth a query can have. By default, there is no limit.
Sourcepub fnlimit_recursive_depth(self, depth:usize) -> Self
pub fnlimit_recursive_depth(self, depth:usize) -> Self
Set the maximum recursive depth a query can have. (default: 32)
If the value is too large, stack overflow may occur, usually32
isenough.
Sourcepub fnlimit_directives(self, max_directives:usize) -> Self
pub fnlimit_directives(self, max_directives:usize) -> Self
Set the maximum number of directives on a single field. (default: nolimit)
Sourcepub fnextension(self, extension: implExtensionFactory) -> Self
pub fnextension(self, extension: implExtensionFactory) -> Self
Add an extension to the schema.
§Examples
useasync_graphql::*;structQuery;#[Object]implQuery {async fnvalue(&self) -> i32 {100}}letschema = Schema::build(Query, EmptyMutation, EmptySubscription) .extension(extensions::Logger) .finish();
Sourcepub fndata<D:Any +Send +Sync>(self, data: D) -> Self
pub fndata<D:Any +Send +Sync>(self, data: D) -> Self
Add a global data that can be accessed in theSchema
. You access itwithContext::data
.
Sourcepub fnvalidation_mode(self, validation_mode:ValidationMode) -> Self
pub fnvalidation_mode(self, validation_mode:ValidationMode) -> Self
Set the validation mode, default isValidationMode::Strict
.
Sourcepub fnenable_federation(self) -> Self
pub fnenable_federation(self) -> Self
Enable federation, which is automatically enabled if the Query has leastone entity definition.
Sourcepub fnenable_subscription_in_federation(self) -> Self
pub fnenable_subscription_in_federation(self) -> Self
Make the Federation SDL include subscriptions.
Note: Not included by default, in order to be compatible with ApolloServer.
Sourcepub fnoverride_input_type_description<T:InputType>( self, desc: &'staticstr,) -> Self
pub fnoverride_input_type_description<T:InputType>( self, desc: &'staticstr,) -> Self
Override the name of the specified input type.
Sourcepub fnoverride_output_type_description<T:OutputType>( self, desc: &'staticstr,) -> Self
pub fnoverride_output_type_description<T:OutputType>( self, desc: &'staticstr,) -> Self
Override the name of the specified output type.
Sourcepub fndirective<T: CustomDirectiveFactory>(self, directive: T) -> Self
pub fndirective<T: CustomDirectiveFactory>(self, directive: T) -> Self
Register a custom directive.
§Panics
Panics if the directive with the same name is already registered.
Sourcepub fndisable_suggestions(self) -> Self
pub fndisable_suggestions(self) -> Self
Disable field suggestions.
Sourcepub fnwith_sorted_fields(self) -> Self
pub fnwith_sorted_fields(self) -> Self
Make all fields sorted on introspection queries.
Sourcepub fnwith_sorted_enums(self) -> Self
pub fnwith_sorted_enums(self) -> Self
Make all enum variants sorted on introspection queries.
Auto Trait Implementations§
impl<Query, Mutation, Subscription>Freeze forSchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> !RefUnwindSafe forSchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription>Send forSchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription>Sync forSchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription>Unpin forSchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> !UnwindSafe forSchemaBuilder<Query, Mutation, Subscription>
Blanket Implementations§
Source§impl<T>BorrowMut<T> for Twhere T: ?Sized,
impl<T>BorrowMut<T> for Twhere T: ?Sized,
Source§fnborrow_mut(&mut self) ->&mut T
fnborrow_mut(&mut self) ->&mut T
Source§impl<T>FmtForward for T
impl<T>FmtForward for T
Source§fnfmt_binary(self) ->FmtBinary<Self>where Self:Binary,
fnfmt_binary(self) ->FmtBinary<Self>where Self:Binary,
self
to use itsBinary
implementation whenDebug
-formatted.Source§fnfmt_display(self) ->FmtDisplay<Self>where Self:Display,
fnfmt_display(self) ->FmtDisplay<Self>where Self:Display,
self
to use itsDisplay
implementation whenDebug
-formatted.Source§fnfmt_lower_exp(self) ->FmtLowerExp<Self>where Self:LowerExp,
fnfmt_lower_exp(self) ->FmtLowerExp<Self>where Self:LowerExp,
self
to use itsLowerExp
implementation whenDebug
-formatted.Source§fnfmt_lower_hex(self) ->FmtLowerHex<Self>where Self:LowerHex,
fnfmt_lower_hex(self) ->FmtLowerHex<Self>where Self:LowerHex,
self
to use itsLowerHex
implementation whenDebug
-formatted.Source§fnfmt_octal(self) ->FmtOctal<Self>where Self:Octal,
fnfmt_octal(self) ->FmtOctal<Self>where Self:Octal,
self
to use itsOctal
implementation whenDebug
-formatted.Source§fnfmt_pointer(self) ->FmtPointer<Self>where Self:Pointer,
fnfmt_pointer(self) ->FmtPointer<Self>where Self:Pointer,
self
to use itsPointer
implementation whenDebug
-formatted.Source§fnfmt_upper_exp(self) ->FmtUpperExp<Self>where Self:UpperExp,
fnfmt_upper_exp(self) ->FmtUpperExp<Self>where Self:UpperExp,
self
to use itsUpperExp
implementation whenDebug
-formatted.Source§fnfmt_upper_hex(self) ->FmtUpperHex<Self>where Self:UpperHex,
fnfmt_upper_hex(self) ->FmtUpperHex<Self>where Self:UpperHex,
self
to use itsUpperHex
implementation whenDebug
-formatted.Source§impl<T>FutureExt for T
impl<T>FutureExt for T
Source§fnwith_context(self, otel_cx:Context) ->WithContext<Self>ⓘ
fnwith_context(self, otel_cx:Context) ->WithContext<Self>ⓘ
Source§fnwith_current_context(self) ->WithContext<Self>ⓘ
fnwith_current_context(self) ->WithContext<Self>ⓘ
Source§impl<T>Instrument for T
impl<T>Instrument for T
Source§fninstrument(self, span:Span) ->Instrumented<Self>ⓘ
fninstrument(self, span:Span) ->Instrumented<Self>ⓘ
Source§fnin_current_span(self) ->Instrumented<Self>ⓘ
fnin_current_span(self) ->Instrumented<Self>ⓘ
Source§impl<T>Instrument for T
impl<T>Instrument for T
Source§fninstrument(self, span:Span) ->Instrumented<Self>ⓘ
fninstrument(self, span:Span) ->Instrumented<Self>ⓘ
Source§fnin_current_span(self) ->Instrumented<Self>ⓘ
fnin_current_span(self) ->Instrumented<Self>ⓘ
Source§impl<T>IntoEither for T
impl<T>IntoEither for T
Source§fninto_either(self, into_left:bool) ->Either<Self, Self>ⓘ
fninto_either(self, into_left:bool) ->Either<Self, Self>ⓘ
self
into aLeft
variant ofEither<Self, Self>
ifinto_left
istrue
.Convertsself
into aRight
variant ofEither<Self, Self>
otherwise.Read moreSource§fninto_either_with<F>(self, into_left: F) ->Either<Self, Self>ⓘ
fninto_either_with<F>(self, into_left: F) ->Either<Self, Self>ⓘ
self
into aLeft
variant ofEither<Self, Self>
ifinto_left(&self)
returnstrue
.Convertsself
into aRight
variant ofEither<Self, Self>
otherwise.Read moreSource§impl<T>Pipe for Twhere T: ?Sized,
impl<T>Pipe for Twhere T: ?Sized,
Source§fnpipe<R>(self, func: implFnOnce(Self) -> R) -> Rwhere Self:Sized,
fnpipe<R>(self, func: implFnOnce(Self) -> R) -> Rwhere Self:Sized,
Source§fnpipe_ref<'a, R>(&'a self, func: implFnOnce(&'a Self) -> R) -> Rwhere R: 'a,
fnpipe_ref<'a, R>(&'a self, func: implFnOnce(&'a Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function.Read moreSource§fnpipe_ref_mut<'a, R>(&'a mut self, func: implFnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
fnpipe_ref_mut<'a, R>(&'a mut self, func: implFnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function.Read moreSource§fnpipe_borrow<'a, B, R>(&'a self, func: implFnOnce(&'a B) -> R) -> R
fnpipe_borrow<'a, B, R>(&'a self, func: implFnOnce(&'a B) -> R) -> R
Source§fnpipe_borrow_mut<'a, B, R>( &'a mut self, func: implFnOnce(&'a mut B) -> R,) -> R
fnpipe_borrow_mut<'a, B, R>( &'a mut self, func: implFnOnce(&'a mut B) -> R,) -> R
Source§fnpipe_as_ref<'a, U, R>(&'a self, func: implFnOnce(&'a U) -> R) -> R
fnpipe_as_ref<'a, U, R>(&'a self, func: implFnOnce(&'a U) -> R) -> R
self
, then passesself.as_ref()
into the pipe function.Source§fnpipe_as_mut<'a, U, R>(&'a mut self, func: implFnOnce(&'a mut U) -> R) -> R
fnpipe_as_mut<'a, U, R>(&'a mut self, func: implFnOnce(&'a mut U) -> R) -> R
self
, then passesself.as_mut()
into the pipefunction.Source§fnpipe_deref<'a, T, R>(&'a self, func: implFnOnce(&'a T) -> R) -> R
fnpipe_deref<'a, T, R>(&'a self, func: implFnOnce(&'a T) -> R) -> R
self
, then passesself.deref()
into the pipe function.Source§impl<T>Tap for T
impl<T>Tap for T
Source§fntap_borrow<B>(self, func: implFnOnce(&B)) -> Self
fntap_borrow<B>(self, func: implFnOnce(&B)) -> Self
Borrow<B>
of a value.Read moreSource§fntap_borrow_mut<B>(self, func: implFnOnce(&mut B)) -> Self
fntap_borrow_mut<B>(self, func: implFnOnce(&mut B)) -> Self
BorrowMut<B>
of a value.Read moreSource§fntap_ref<R>(self, func: implFnOnce(&R)) -> Self
fntap_ref<R>(self, func: implFnOnce(&R)) -> Self
AsRef<R>
view of a value.Read moreSource§fntap_ref_mut<R>(self, func: implFnOnce(&mut R)) -> Self
fntap_ref_mut<R>(self, func: implFnOnce(&mut R)) -> Self
AsMut<R>
view of a value.Read moreSource§fntap_deref<T>(self, func: implFnOnce(&T)) -> Self
fntap_deref<T>(self, func: implFnOnce(&T)) -> Self
Deref::Target
of a value.Read moreSource§fntap_deref_mut<T>(self, func: implFnOnce(&mut T)) -> Self
fntap_deref_mut<T>(self, func: implFnOnce(&mut T)) -> Self
Deref::Target
of a value.Read moreSource§fntap_dbg(self, func: implFnOnce(&Self)) -> Self
fntap_dbg(self, func: implFnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fntap_mut_dbg(self, func: implFnOnce(&mut Self)) -> Self
fntap_mut_dbg(self, func: implFnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in releasebuilds.Source§fntap_borrow_dbg<B>(self, func: implFnOnce(&B)) -> Self
fntap_borrow_dbg<B>(self, func: implFnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in releasebuilds.Source§fntap_borrow_mut_dbg<B>(self, func: implFnOnce(&mut B)) -> Self
fntap_borrow_mut_dbg<B>(self, func: implFnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in releasebuilds.Source§fntap_ref_dbg<R>(self, func: implFnOnce(&R)) -> Self
fntap_ref_dbg<R>(self, func: implFnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in releasebuilds.Source§fntap_ref_mut_dbg<R>(self, func: implFnOnce(&mut R)) -> Self
fntap_ref_mut_dbg<R>(self, func: implFnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in releasebuilds.Source§fntap_deref_dbg<T>(self, func: implFnOnce(&T)) -> Self
fntap_deref_dbg<T>(self, func: implFnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in releasebuilds.