pub struct Field { /* private fields */ }
Expand description

A GraphQL field

Implementations§

source§

impl Field

source

pub fn new<N, T, F>(name: N, ty: T, resolver_fn: F) -> Fieldwhere N: Into<String>, T: Into<TypeRef>, F: for<'a> Fn(ResolverContext<'a>) -> FieldFuture<'a> + Send + Sync + 'static,

Create a GraphQL field

source

pub fn description(self, description: impl Into<String>) -> Field

Set the description

source

pub fn deprecation(self, reason: Option<&str>) -> Field

Set the description

source

pub fn external(self) -> Field

Mark a field as owned by another service. This allows service A to use fields from service B while also knowing at runtime the types of that field.

source

pub fn requires(self, fields: impl Into<String>) -> Field

Annotate the required input fieldset from a base type for a resolver. It is used to develop a query plan where the required fields may not be needed by the client, but the service may need additional information from other services.

source

pub fn provides(self, fields: impl Into<String>) -> Field

Annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the gateway.

source

pub fn shareable(self) -> Field

Indicate that an object type’s field is allowed to be resolved by multiple subgraphs

source

pub fn inaccessible(self) -> Field

Indicate that an enum is not accessible from a supergraph when using Apollo Federation

Reference: https://www.apollographql.com/docs/federation/federated-types/federated-directives/#inaccessible

source

pub fn tags<I, T>(self, tags: I) -> Fieldwhere I: IntoIterator<Item = T>, T: Into<String>,

Arbitrary string metadata that will be propagated to the supergraph when using Apollo Federation. This attribute is repeatable

Reference: https://www.apollographql.com/docs/federation/federated-types/federated-directives/#applying-metadata

source

pub fn override_from(self, name: impl Into<String>) -> Field

Indicate that an object type’s field is allowed to be resolved by multiple subgraphs

source

pub fn argument(self, input_value: InputValue) -> Field

Add an argument to the field

Trait Implementations§

source§

impl Debug for Field

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Field

§

impl Send for Field

§

impl Sync for Field

§

impl Unpin for Field

§

impl !UnwindSafe for Field

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.