pub fn field_type(input: &str) -> IResult<&str, Type>
Expand description
Parse the type part of a field decl.
use rust_lcm_codegen::parser::{field_type, Type, PrimitiveType, StructType};
assert_eq!(field_type("int8_t"), Ok(("", Type::Primitive(PrimitiveType::Int8))));
assert_eq!(field_type("foo.bar"),
Ok(("", Type::Struct(StructType { namespace: Some("foo".to_string()), name: "bar".to_string() }))));
assert_eq!(field_type("foo"),
Ok(("", Type::Struct(StructType { namespace: None, name: "foo".to_string() }))));