Struct apollo_encoder::EnumDef [−][src]
pub struct EnumDef { /* fields omitted */ }Expand description
Enums are special scalars that can only have a defined set of values.
EnumTypeDefinition: Description? enum Name Directives? EnumValuesDefinition?
Detailed documentation can be found in GraphQL spec.
Example
use apollo_encoder::{EnumValue, EnumDef};
let mut enum_ty_1 = EnumValue::new("CAT_TREE".to_string());
enum_ty_1.description(Some("Top bunk of a cat tree.".to_string()));
let enum_ty_2 = EnumValue::new("BED".to_string());
let mut enum_ty_3 = EnumValue::new("CARDBOARD_BOX".to_string());
enum_ty_3.deprecated(Some("Box was recycled.".to_string()));
let mut enum_ = EnumDef::new("NapSpots".to_string());
enum_.description(Some("Favourite cat nap spots.".to_string()));
enum_.value(enum_ty_1);
enum_.value(enum_ty_2);
enum_.value(enum_ty_3);
assert_eq!(
enum_.to_string(),
r#""Favourite cat nap spots."
enum NapSpots {
"Top bunk of a cat tree."
CAT_TREE
BED
CARDBOARD_BOX @deprecated(reason: "Box was recycled.")
}
"#
);Implementations
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for EnumDef
impl UnwindSafe for EnumDef
Blanket Implementations
Mutably borrows from an owned value. Read more