2020-03-03 11:15:18 +00:00
use crate ::model ::__Type ;
2020-09-13 03:41:15 +00:00
use crate ::{ registry , GQLObject } ;
2020-03-03 11:15:18 +00:00
pub struct __InputValue < ' a > {
pub registry : & ' a registry ::Registry ,
2020-05-15 02:08:37 +00:00
pub input_value : & ' a registry ::MetaInputValue ,
2020-03-03 11:15:18 +00:00
}
2020-05-10 04:41:05 +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-09-13 03:41:15 +00:00
#[ GQLObject(internal) ]
2020-03-05 06:23:55 +00:00
impl < ' a > __InputValue < ' a > {
2020-03-28 12:11:26 +00:00
async fn name ( & self ) -> String {
2020-03-05 06:23:55 +00:00
self . input_value . name . to_string ( )
2020-03-03 11:15:18 +00:00
}
2020-03-28 12:11:26 +00:00
async fn description ( & self ) -> Option < String > {
2020-03-05 06:23:55 +00:00
self . input_value . description . map ( | s | s . to_string ( ) )
2020-03-03 11:15:18 +00:00
}
2020-03-05 06:23:55 +00:00
#[ field(name = " type " ) ]
2020-03-28 12:11:26 +00:00
async fn ty ( & self ) -> __Type < ' a > {
2020-03-05 06:23:55 +00:00
__Type ::new ( self . registry , & self . input_value . ty )
2020-03-03 11:15:18 +00:00
}
2020-03-28 12:11:26 +00:00
async fn default_value ( & self ) -> Option < String > {
2020-05-26 10:34:43 +00:00
self . input_value . default_value . clone ( )
2020-03-03 11:15:18 +00:00
}
}