pub struct Field {
    pub definition: Node<FieldDefinition>,
    pub alias: Option<Name>,
    pub name: Name,
    pub arguments: Vec<Node<Argument>>,
    pub directives: Directives,
    pub selection_set: SelectionSet,
}

Fields§

§definition: Node<FieldDefinition>

The definition of this field in an object type or interface type definition in the schema

§alias: Option<Name>§name: Name§arguments: Vec<Node<Argument>>§directives: Directives§selection_set: SelectionSet

Implementations§

source§

impl Field

source

pub fn new(name: impl Into<Name>, definition: Node<FieldDefinition>) -> Self

Create a new field with the given name and type.

See SelectionSet::new_field too look up the type in a schema instead.

source

pub fn with_alias(self, alias: impl Into<Name>) -> Self

source

pub fn with_opt_alias(self, alias: Option<impl Into<Name>>) -> Self

source

pub fn with_directive(self, directive: impl Into<Node<Directive>>) -> Self

source

pub fn with_directives( self, directives: impl IntoIterator<Item = Node<Directive>> ) -> Self

source

pub fn with_argument( self, name: impl Into<Name>, value: impl Into<Node<Value>> ) -> Self

source

pub fn with_arguments( self, arguments: impl IntoIterator<Item = Node<Argument>> ) -> Self

source

pub fn with_selection(self, selection: impl Into<Selection>) -> Self

source

pub fn with_selections( self, selections: impl IntoIterator<Item = impl Into<Selection>> ) -> Self

source

pub fn response_key(&self) -> &Name

Returns the response key for this field: the alias if there is one, or the name

source

pub fn ty(&self) -> &Type

The type of this field, from the field definition

source

pub fn inner_type_def<'a>(&self, schema: &'a Schema) -> Option<&'a ExtendedType>

Look up in schema the definition of the inner type of this field.

The inner type is ty() after unwrapping non-null and list markers.

Trait Implementations§

source§

impl Clone for Field

source§

fn clone(&self) -> Field

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Field

source§

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

Formats the value using the given formatter. Read more
source§

impl From<Field> for Selection

source§

fn from(value: Field) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Field

source§

fn eq(&self, other: &Field) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Field

source§

impl StructuralEq for Field

source§

impl StructuralPartialEq for Field

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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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.