2021-11-11 07:22:40 +00:00
|
|
|
use std::collections::HashSet;
|
|
|
|
|
2022-04-19 04:25:11 +00:00
|
|
|
use crate::{model::__Type, registry, Object};
|
2020-03-03 11:15:18 +00:00
|
|
|
|
|
|
|
pub struct __InputValue<'a> {
|
|
|
|
pub registry: &'a registry::Registry,
|
2021-11-11 07:22:40 +00:00
|
|
|
pub visible_types: &'a HashSet<&'a str>,
|
2020-05-15 02:08:37 +00:00
|
|
|
pub input_value: &'a registry::MetaInputValue,
|
2020-03-03 11:15:18 +00:00
|
|
|
}
|
|
|
|
|
2022-04-19 04:25:11 +00:00
|
|
|
/// Arguments provided to Fields or Directives and the input fields of an
|
|
|
|
/// InputObject are represented as Input Values which describe their type and
|
|
|
|
/// optionally a default value.
|
2020-10-14 09:08:57 +00:00
|
|
|
#[Object(internal, name = "__InputValue")]
|
2020-03-05 06:23:55 +00:00
|
|
|
impl<'a> __InputValue<'a> {
|
2021-02-27 03:59:58 +00:00
|
|
|
#[inline]
|
2021-02-24 04:06:11 +00:00
|
|
|
async fn name(&self) -> &str {
|
|
|
|
self.input_value.name
|
2020-03-03 11:15:18 +00:00
|
|
|
}
|
|
|
|
|
2021-02-27 03:59:58 +00:00
|
|
|
#[inline]
|
2021-02-24 04:06:11 +00:00
|
|
|
async fn description(&self) -> Option<&str> {
|
|
|
|
self.input_value.description
|
2020-03-03 11:15:18 +00:00
|
|
|
}
|
|
|
|
|
2020-09-28 09:44:00 +00:00
|
|
|
#[graphql(name = "type")]
|
2021-02-27 03:59:58 +00:00
|
|
|
#[inline]
|
2020-03-28 12:11:26 +00:00
|
|
|
async fn ty(&self) -> __Type<'a> {
|
2021-11-11 07:22:40 +00:00
|
|
|
__Type::new(self.registry, self.visible_types, &self.input_value.ty)
|
2020-03-03 11:15:18 +00:00
|
|
|
}
|
|
|
|
|
2021-02-27 03:59:58 +00:00
|
|
|
#[inline]
|
2021-02-24 04:06:11 +00:00
|
|
|
async fn default_value(&self) -> Option<&str> {
|
|
|
|
self.input_value.default_value.as_deref()
|
2020-03-03 11:15:18 +00:00
|
|
|
}
|
|
|
|
}
|