pub struct DirectiveProcessor { /* private fields */ }Expand description
The main directive processor engine.
Implementations§
Source§impl DirectiveProcessor
impl DirectiveProcessor
Sourcepub fn register(&mut self, definition: DirectiveDefinition)
pub fn register(&mut self, definition: DirectiveDefinition)
Register a custom directive definition.
Sourcepub fn is_registered(&self, name: &str) -> bool
pub fn is_registered(&self, name: &str) -> bool
Check if a directive is registered.
Sourcepub fn get_definition(&self, name: &str) -> Option<&DirectiveDefinition>
pub fn get_definition(&self, name: &str) -> Option<&DirectiveDefinition>
Get a directive definition by name.
Sourcepub fn registered_names(&self) -> Vec<String>
pub fn registered_names(&self) -> Vec<String>
Return the names of all registered directives.
Sourcepub fn validate(&self, applied: &AppliedDirective) -> Result<(), DirectiveError>
pub fn validate(&self, applied: &AppliedDirective) -> Result<(), DirectiveError>
Validate that an applied directive’s arguments match its schema.
Sourcepub fn detect_conflicts(
&self,
directives: &[AppliedDirective],
) -> Result<(), DirectiveError>
pub fn detect_conflicts( &self, directives: &[AppliedDirective], ) -> Result<(), DirectiveError>
Detect conflicts among a set of directives applied to the same field.
Sourcepub fn execute_skip(
&self,
applied: &AppliedDirective,
) -> Result<DirectiveOutcome, DirectiveError>
pub fn execute_skip( &self, applied: &AppliedDirective, ) -> Result<DirectiveOutcome, DirectiveError>
Execute the @skip directive.
Sourcepub fn execute_include(
&self,
applied: &AppliedDirective,
) -> Result<DirectiveOutcome, DirectiveError>
pub fn execute_include( &self, applied: &AppliedDirective, ) -> Result<DirectiveOutcome, DirectiveError>
Execute the @include directive.
Sourcepub fn execute_deprecated(
&mut self,
applied: &AppliedDirective,
type_name: &str,
field_name: &str,
) -> Result<DirectiveOutcome, DirectiveError>
pub fn execute_deprecated( &mut self, applied: &AppliedDirective, type_name: &str, field_name: &str, ) -> Result<DirectiveOutcome, DirectiveError>
Execute the @deprecated directive and record the deprecation.
Sourcepub fn execute_auth(
&self,
applied: &AppliedDirective,
user_roles: &[String],
) -> Result<DirectiveOutcome, DirectiveError>
pub fn execute_auth( &self, applied: &AppliedDirective, user_roles: &[String], ) -> Result<DirectiveOutcome, DirectiveError>
Execute the @auth directive with the user’s roles.
Sourcepub fn execute_cache(
&mut self,
_applied: &AppliedDirective,
cache_key: &str,
current_time_ms: u64,
) -> Result<DirectiveOutcome, DirectiveError>
pub fn execute_cache( &mut self, _applied: &AppliedDirective, cache_key: &str, current_time_ms: u64, ) -> Result<DirectiveOutcome, DirectiveError>
Execute the @cache directive.
Sourcepub fn cache_store(
&mut self,
applied: &AppliedDirective,
cache_key: &str,
value: &str,
current_time_ms: u64,
)
pub fn cache_store( &mut self, applied: &AppliedDirective, cache_key: &str, value: &str, current_time_ms: u64, )
Store a value in the cache for the @cache directive.
Sourcepub fn generate_cache_key(
type_name: &str,
field_name: &str,
args: &HashMap<String, ArgumentValue>,
) -> String
pub fn generate_cache_key( type_name: &str, field_name: &str, args: &HashMap<String, ArgumentValue>, ) -> String
Generate a cache key for a field + arguments combination.
Sourcepub fn process_directives(
&mut self,
directives: &[AppliedDirective],
phase: DirectivePhase,
user_roles: &[String],
cache_key: &str,
current_time_ms: u64,
type_name: &str,
field_name: &str,
) -> Result<DirectiveOutcome, DirectiveError>
pub fn process_directives( &mut self, directives: &[AppliedDirective], phase: DirectivePhase, user_roles: &[String], cache_key: &str, current_time_ms: u64, type_name: &str, field_name: &str, ) -> Result<DirectiveOutcome, DirectiveError>
Process a list of directives for a field in the correct phase order.
Sourcepub fn deprecations(&self) -> &[DeprecationInfo]
pub fn deprecations(&self) -> &[DeprecationInfo]
Return all tracked deprecations.
Sourcepub fn cache_size(&self) -> usize
pub fn cache_size(&self) -> usize
Return the number of cached entries.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the directive cache.
Sourcepub fn evict_expired(&mut self, current_time_ms: u64)
pub fn evict_expired(&mut self, current_time_ms: u64)
Evict expired entries from the cache.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DirectiveProcessor
impl RefUnwindSafe for DirectiveProcessor
impl Send for DirectiveProcessor
impl Sync for DirectiveProcessor
impl Unpin for DirectiveProcessor
impl UnsafeUnpin for DirectiveProcessor
impl UnwindSafe for DirectiveProcessor
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more