pub struct EnumValue { /* private fields */ }
Expand description
The EnumValue type represents one of possible values of an enum.
EnumValueDefinition: Description? EnumValue Directives?
Detailed documentation can be found in GraphQL spec.
§Example
use apollo_encoder::{Argument, Directive, EnumValue, Value};
let mut enum_ty = EnumValue::new("CARDBOARD_BOX".to_string());
enum_ty.description("Box nap spot.".to_string());
let mut deprecated_directive = Directive::new(String::from("deprecated"));
deprecated_directive.arg(Argument::new(
String::from("reason"),
Value::String(String::from(
"Box was recycled.",
)),
));
enum_ty.directive(deprecated_directive);
assert_eq!(
enum_ty.to_string(),
r#" "Box nap spot."
CARDBOARD_BOX @deprecated(reason: "Box was recycled.")"#
);
Implementations§
Trait Implementations§
Source§impl TryFrom<EnumValueDefinition> for EnumValue
impl TryFrom<EnumValueDefinition> for EnumValue
Source§fn try_from(node: EnumValueDefinition) -> Result<Self, Self::Error>
fn try_from(node: EnumValueDefinition) -> Result<Self, Self::Error>
Create an apollo-encoder node from an apollo-parser one.
§Errors
This returns an error if the apollo-parser tree is not valid. The error doesn’t have much context due to TryFrom API constraints: validate the parse tree before using TryFrom if granular errors are important to you.
impl StructuralPartialEq for EnumValue
Auto Trait Implementations§
impl Freeze for EnumValue
impl RefUnwindSafe for EnumValue
impl Send for EnumValue
impl Sync for EnumValue
impl Unpin for EnumValue
impl UnwindSafe for EnumValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more