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 type | GraphQL type |
|---|---|
String, &str, Cow<str> | String! |
bool | Boolean! |
i8, i16, i32, u8, u16 | Int! |
f32, f64 | Float! |
crate::ID | ID! |
Option<T> | T with the outer non-null removed |
Vec<T> | [T]!, keeping T’s own nullability |
Box<T>, Arc<T> | T |
crate::Raw | T’s GraphQL type, with a prebuilt value |
| a derived object, enum, scalar or union | its 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§
Sourcefn output_type() -> TypeRef
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".