pub struct GraphqlSchemaImpl { /* private fields */ }Expand description
Concrete GraphqlSchema holding a built
async_graphql::Schema<QueryRoot, MutationRoot, SubscriptionRoot>.
Implementations§
Source§impl GraphqlSchemaImpl
impl GraphqlSchemaImpl
Sourcepub fn new(
query: QueryRoot,
mutation: MutationRoot,
subscription: SubscriptionRoot,
) -> Self
pub fn new( query: QueryRoot, mutation: MutationRoot, subscription: SubscriptionRoot, ) -> Self
Build a schema from the given query, mutation, and subscription
roots. No auth role is injected — all guarded fields will
reject requests. Use GraphqlSchemaImpl::with_role for
authenticated schemas.
Sourcepub fn with_role(
query: QueryRoot,
mutation: MutationRoot,
subscription: SubscriptionRoot,
role: AuthRole,
) -> Self
pub fn with_role( query: QueryRoot, mutation: MutationRoot, subscription: SubscriptionRoot, role: AuthRole, ) -> Self
Build a schema with a default AuthRole injected as global
data. All guarded fields will use this role for authorization.
Test-only. Production code should use GraphqlSchemaImpl::new
and inject the role per-request via async_graphql::Request::data
or async_graphql::BatchRequest::data, so the caller’s actual
session role is enforced. This constructor is retained for tests
and the dev path where no auth is configured.
Trait Implementations§
Source§impl GraphqlSchema for GraphqlSchemaImpl
impl GraphqlSchema for GraphqlSchemaImpl
Source§fn schema(&self) -> &Schema<QueryRoot, MutationRoot, SubscriptionRoot>
fn schema(&self) -> &Schema<QueryRoot, MutationRoot, SubscriptionRoot>
The built
async_graphql::Schema.Auto Trait Implementations§
impl !RefUnwindSafe for GraphqlSchemaImpl
impl !UnwindSafe for GraphqlSchemaImpl
impl Freeze for GraphqlSchemaImpl
impl Send for GraphqlSchemaImpl
impl Sync for GraphqlSchemaImpl
impl Unpin for GraphqlSchemaImpl
impl UnsafeUnpin for GraphqlSchemaImpl
Blanket Implementations§
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