pub trait GraphQLFields {
type FullType;
// Required method
fn selection() -> String;
}Expand description
Trait implemented by types that know their GraphQL field selection.
The FullType associated type ties this implementation to a specific
GraphQL schema type, enabling compile-time validation:
- Generated types set
FullType = Self— they validate against themselves. - Custom lean types set
FullTypeto the corresponding generated type, enabling compile-time field existence and type checks via#[graphql(full_type = X)].
§Example
ⓘ
use lineark_sdk::generated::types::Team;
#[derive(Deserialize, GraphQLFields)]
#[graphql(full_type = Team)]
struct TeamRow {
id: String,
key: String,
name: String,
}
// Compile-time validated: TeamRow fields exist on Team with compatible types
let teams = client.teams::<TeamRow>().first(10).send().await?;Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.