[lang] Quick-fix for missing Hash and Momentum from api descriptions

parent d803c2e2
......@@ -263,6 +263,10 @@ pub enum PrimitiveTypeDescription {
AccountId,
/// The SRML balance type.
Balance,
/// The SRML hash type.
Hash,
/// The SRML moment type.
Moment,
}
impl TryFrom<&syn::TypePath> for PrimitiveTypeDescription {
......@@ -285,6 +289,8 @@ impl TryFrom<&syn::TypePath> for PrimitiveTypeDescription {
"i128" => Ok(PrimitiveTypeDescription::I128),
"AccountId" => Ok(PrimitiveTypeDescription::AccountId),
"Balance" => Ok(PrimitiveTypeDescription::Balance),
"Hash" => Ok(PrimitiveTypeDescription::Hash),
"Moment" => Ok(PrimitiveTypeDescription::Moment),
unsupported => {
bail!(
ty,
......@@ -555,6 +561,30 @@ mod tests {
assert_eq!(td, deserialized);
}
#[test]
fn primitives() {
assert_eq_type_description(
parse_quote!(u16),
Primitive(PrimitiveTypeDescription::U16),
);
assert_eq_type_description(
parse_quote!(bool),
Primitive(PrimitiveTypeDescription::Bool),
);
assert_eq_type_description(
parse_quote!(i64),
Primitive(PrimitiveTypeDescription::I64),
);
assert_eq_type_description(
parse_quote!(AccountId),
Primitive(PrimitiveTypeDescription::AccountId),
);
assert_eq_type_description(
parse_quote!(Moment),
Primitive(PrimitiveTypeDescription::Moment),
);
}
#[test]
fn tuple_basic() {
assert_eq_type_description(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment