Skip to main content

OutputType

Trait OutputType 

Source
pub trait OutputType {
    // Required method
    fn output_type() -> TypeRef;
}
Expand description

A Rust type that may appear in an output position.

The mapping is:

Rust typeGraphQL type
String, &str, Cow<str>String!
boolBoolean!
i8, i16, i32, u8, u16Int!
f32, f64Float!
crate::IDID!
Option<T>T with the outer non-null removed
Vec<T>[T]!, keeping T’s own nullability
Box<T>, Arc<T>T
crate::RawT’s GraphQL type, with a prebuilt value
a derived object, enum, scalar or unionits GraphQL name

There is deliberately no mapping from Result<T, E>: a fallible field is declared with one of the *_result methods so the schema builder can tell the two cases apart.

Required Methods§

Source

fn output_type() -> TypeRef

The GraphQL type of values produced by this Rust type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl OutputType for &str

Source§

impl OutputType for Cow<'_, str>

Source§

impl OutputType for String

Source§

impl OutputType for bool

Source§

impl OutputType for f32

Source§

impl OutputType for f64

Source§

impl OutputType for i8

Source§

impl OutputType for i16

Source§

impl OutputType for i32

Source§

impl OutputType for u8

Source§

impl OutputType for u16

Source§

impl<T: OutputType> OutputType for Arc<T>

Source§

impl<T: OutputType> OutputType for Box<T>

Source§

impl<T: OutputType> OutputType for Option<T>

Source§

impl<T: OutputType> OutputType for Vec<T>

Implementors§