async-graphql/src/model/enum_value.rs

33 lines
827 B
Rust
Raw Normal View History

use crate::{registry, Object};
2020-03-02 11:25:21 +00:00
2020-03-03 11:15:18 +00:00
pub struct __EnumValue<'a> {
pub registry: &'a registry::Registry,
pub value: &'a registry::MetaEnumValue,
2020-03-03 11:15:18 +00:00
}
2020-03-02 11:25:21 +00:00
2022-04-19 04:25:11 +00:00
/// One possible value for a given Enum. Enum values are unique values, not a
/// placeholder for a string or numeric value. However an Enum value is returned
/// in a JSON response as a string.
2020-10-14 09:08:57 +00:00
#[Object(internal, name = "__EnumValue")]
2020-03-05 06:23:55 +00:00
impl<'a> __EnumValue<'a> {
#[inline]
async fn name(&self) -> &str {
self.value.name
2020-03-02 11:25:21 +00:00
}
#[inline]
async fn description(&self) -> Option<&str> {
self.value.description
2020-03-02 11:25:21 +00:00
}
#[inline]
2020-05-01 23:57:34 +00:00
async fn is_deprecated(&self) -> bool {
self.value.deprecation.is_deprecated()
2020-03-02 11:25:21 +00:00
}
#[inline]
async fn deprecation_reason(&self) -> Option<&str> {
self.value.deprecation.reason()
2020-03-02 11:25:21 +00:00
}
}