Skip to main content

DirectiveProcessor

Struct DirectiveProcessor 

Source
pub struct DirectiveProcessor { /* private fields */ }
Expand description

The main directive processor engine.

Implementations§

Source§

impl DirectiveProcessor

Source

pub fn new() -> Self

Create a new processor with the built-in directives pre-registered.

Source

pub fn empty() -> Self

Create an empty processor with no built-in directives.

Source

pub fn register(&mut self, definition: DirectiveDefinition)

Register a custom directive definition.

Source

pub fn is_registered(&self, name: &str) -> bool

Check if a directive is registered.

Source

pub fn get_definition(&self, name: &str) -> Option<&DirectiveDefinition>

Get a directive definition by name.

Source

pub fn registered_names(&self) -> Vec<String>

Return the names of all registered directives.

Source

pub fn validate(&self, applied: &AppliedDirective) -> Result<(), DirectiveError>

Validate that an applied directive’s arguments match its schema.

Source

pub fn detect_conflicts( &self, directives: &[AppliedDirective], ) -> Result<(), DirectiveError>

Detect conflicts among a set of directives applied to the same field.

Source

pub fn execute_skip( &self, applied: &AppliedDirective, ) -> Result<DirectiveOutcome, DirectiveError>

Execute the @skip directive.

Source

pub fn execute_include( &self, applied: &AppliedDirective, ) -> Result<DirectiveOutcome, DirectiveError>

Execute the @include directive.

Source

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.

Source

pub fn execute_auth( &self, applied: &AppliedDirective, user_roles: &[String], ) -> Result<DirectiveOutcome, DirectiveError>

Execute the @auth directive with the user’s roles.

Source

pub fn execute_cache( &mut self, _applied: &AppliedDirective, cache_key: &str, current_time_ms: u64, ) -> Result<DirectiveOutcome, DirectiveError>

Execute the @cache directive.

Source

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.

Source

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.

Source

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.

Source

pub fn deprecations(&self) -> &[DeprecationInfo]

Return all tracked deprecations.

Source

pub fn cache_size(&self) -> usize

Return the number of cached entries.

Source

pub fn clear_cache(&mut self)

Clear the directive cache.

Source

pub fn evict_expired(&mut self, current_time_ms: u64)

Evict expired entries from the cache.

Trait Implementations§

Source§

impl Default for DirectiveProcessor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyExt for T
where T: Any + ?Sized,

Source§

fn is<T>(&self) -> bool
where T: Any + ?Sized,

Returns true if the this type is the same as T.
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: Any,

Returns Some reference to this value if it’s of type T, or None otherwise.
Source§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: Any,

Returns Some mutable reference to this value if it’s of type T, or None otherwise.
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeDebug for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more