pub struct GraphqlPlugin { /* private fields */ }Expand description
Compiled GraphQL schema and execution engine backing GraphqlHook.
Implementations§
Source§impl GraphqlPlugin
Schema registration and GraphQL execution engine for GraphqlPlugin.
impl GraphqlPlugin
Schema registration and GraphQL execution engine for GraphqlPlugin.
Sourcepub fn new(config: GraphqlConfig) -> Self
pub fn new(config: GraphqlConfig) -> Self
Creates a new GraphqlPlugin with empty query and mutation registries.
§Arguments
GraphqlConfig- GraphQL configuration.
§Returns
Self- New GraphQL engine ready for resolver registration.
Sourcepub fn with_query<N, F>(self, field_name: N, resolver: F) -> Self
pub fn with_query<N, F>(self, field_name: N, resolver: F) -> Self
Sourcepub fn with_mutation<N, F>(self, field_name: N, resolver: F) -> Self
pub fn with_mutation<N, F>(self, field_name: N, resolver: F) -> Self
Sourcepub fn init(plugin: Self) -> &'static Self
pub fn init(plugin: Self) -> &'static Self
Installs plugin as the global GraphqlPlugin singleton once.
§Arguments
Self- Configured GraphQL engine.
§Returns
&'static Self- Reference to the global plugin.
Sourcepub fn get() -> Option<&'static Self>
pub fn get() -> Option<&'static Self>
Returns the initialized global GraphqlPlugin, if configured.
§Returns
Option<&'static Self>- Reference to the global plugin, orNone.
Sourcepub fn execute(
&self,
req: &GraphqlRequest,
allow_mutation: bool,
) -> GraphqlResponse
pub fn execute( &self, req: &GraphqlRequest, allow_mutation: bool, ) -> GraphqlResponse
Executes a GraphqlRequest against registered query or mutation resolvers.
§Arguments
&GraphqlRequest- Parsed request envelope.bool- Whether mutations are permitted (trueforPOST,falseforGET).
§Returns
GraphqlResponse- Spec-compliant data/errors response.
Sourcepub fn handle_http_request(&self, request: &Request) -> (HttpStatus, Vec<u8>)
pub fn handle_http_request(&self, request: &Request) -> (HttpStatus, Vec<u8>)
Auto Trait Implementations§
impl !RefUnwindSafe for GraphqlPlugin
impl !UnwindSafe for GraphqlPlugin
impl Forget for GraphqlPlugin
impl Freeze for GraphqlPluginwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<fn() -> XxHash3_64>: Freeze,
PhantomData<(String, Arc<dyn GraphqlResolver>)>: Freeze,
impl Move for GraphqlPlugin
impl Send for GraphqlPlugin
impl Sync for GraphqlPlugin
impl Unpin for GraphqlPlugin
impl UnsafeUnpin for GraphqlPluginwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<fn() -> XxHash3_64>: UnsafeUnpin,
PhantomData<(String, Arc<dyn GraphqlResolver>)>: UnsafeUnpin,
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendSync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more