async_graphql/model/
enum_value.rs

1use crate::{registry, Object};
2
3pub struct __EnumValue<'a> {
4    pub value: &'a registry::MetaEnumValue,
5}
6
7/// One possible value for a given Enum. Enum values are unique values, not a
8/// placeholder for a string or numeric value. However an Enum value is returned
9/// in a JSON response as a string.
10#[Object(internal, name = "__EnumValue")]
11impl __EnumValue<'_> {
12    #[inline]
13    async fn name(&self) -> &str {
14        &self.value.name
15    }
16
17    #[inline]
18    async fn description(&self) -> Option<&str> {
19        self.value.description.as_deref()
20    }
21
22    #[inline]
23    async fn is_deprecated(&self) -> bool {
24        self.value.deprecation.is_deprecated()
25    }
26
27    #[inline]
28    async fn deprecation_reason(&self) -> Option<&str> {
29        self.value.deprecation.reason()
30    }
31}